Snipplrhttp://snipplr.com/tags/conditional
Recent snippets posted on Snipplr.comen-usWed, 01 Apr 2015 08:13:23 GMT(HTML) HTML Tag IE Conditional Comments - Japegrapehttp://snipplr.com/view/74980/html-tag-ie-conditional-comments/
Code to replace your opening tag with conditionally set IE classes, including IE10. ]]>Fri, 27 Jun 2014 05:12:58 GMThttp://snipplr.com/view/74980/html-tag-ie-conditional-comments/(PHP) Check if current post type is a custom post type – WordPress - jonasethomsenhttp://snipplr.com/view/71803/check-if-current-post-type-is-a-custom-post-type--wordpress/
Check if current post type is a custom post type – WordPress.
Returns a true/false-statement.
Can be used outside The Loop. ]]>Thu, 11 Jul 2013 06:28:23 GMThttp://snipplr.com/view/71803/check-if-current-post-type-is-a-custom-post-type--wordpress/(PHP) Wordpress Conditional statement for Singular Custom Post Type - i-am-andyhttp://snipplr.com/view/67604/wordpress-conditional-statement-for-singular-custom-post-type/
Suppose you wanted to check if a user was viewing a singular post with the post type of testimonial. You can use the next code sample to perform this check. ]]>Thu, 04 Oct 2012 20:43:14 GMThttp://snipplr.com/view/67604/wordpress-conditional-statement-for-singular-custom-post-type/(PHP) WP If Home - ryarwoodhttp://snipplr.com/view/62856/wp-if-home/
]]>Mon, 30 Jan 2012 08:47:11 GMThttp://snipplr.com/view/62856/wp-if-home/(HTML) Faster page load hack - IE conditional comments - Huskiehttp://snipplr.com/view/62494/faster-page-load-hack--ie-conditional-comments/
This empty conditional comment hack is used to basically increase performance of a website. When conditional comments are used on a site, for example, for an IE6 conditional stylesheet, it will block further downloads until the css files are fully downloaded, hence increasing load time. To solve this issue, an empty conditional comment, like below, is used before any CSS is loaded in the document, and the problem will be solved! ]]>Thu, 12 Jan 2012 02:04:40 GMThttp://snipplr.com/view/62494/faster-page-load-hack--ie-conditional-comments/(PHP) WordPress CSS based on page title (Conditional) - stephcodehttp://snipplr.com/view/61055/wordpress-css-based-on-page-title-conditional/
]]>Tue, 22 Nov 2011 09:51:50 GMThttp://snipplr.com/view/61055/wordpress-css-based-on-page-title-conditional/(PHP) EE Multi Template Page if statement - ryarwoodhttp://snipplr.com/view/60469/ee-multi-template-page-if-statement/
]]>Wed, 02 Nov 2011 11:37:33 GMThttp://snipplr.com/view/60469/ee-multi-template-page-if-statement/(PHP) Conditional Statement if Custom Field Exists Wordpress - i-am-andyhttp://snipplr.com/view/60283/conditional-statement-if-custom-field-exists-wordpress/
Only show content if Custom Field exists ]]>Fri, 28 Oct 2011 00:51:52 GMThttp://snipplr.com/view/60283/conditional-statement-if-custom-field-exists-wordpress/(Other) EE Multi Template Page if statement - ryarwoodhttp://snipplr.com/view/60072/ee-multi-template-page-if-statement/
]]>Sat, 22 Oct 2011 08:58:12 GMThttp://snipplr.com/view/60072/ee-multi-template-page-if-statement/(VB.NET) Global System Object extensions for easier conditionals (VB.net example) - bryanlymanhttp://snipplr.com/view/59759/global-system-object-extensions-for-easier-conditionals-vbnet-example/
Because there is no way to use object extenders in vb.net here is an example of how you can get similar functionality. See the C# example for further info. ]]>Fri, 14 Oct 2011 16:45:34 GMThttp://snipplr.com/view/59759/global-system-object-extensions-for-easier-conditionals-vbnet-example/(PHP) Thematic Insert Random HTML with condition - scottnixhttp://snipplr.com/view/59456/thematic-insert-random-html-with-condition/
Insert a random div example with WordPress conditional logic to a Thematic action hook. ]]>Thu, 06 Oct 2011 04:41:36 GMThttp://snipplr.com/view/59456/thematic-insert-random-html-with-condition/(PHP) Conditional WordPress function to detect page templates when the page is used to display posts, not page content. - jamalorghttp://snipplr.com/view/58084/conditional-wordpress-function-to-detect-page-templates-when-the-page-is-used-to-display-posts-not-page-content/
`is_page_template()` returns false when the page in question was set to display blog posts via `Admin -> Settings -> Reading -> [Posts page]`. I've wasted few good hours figuring out what's going on, but finally, I've come up with this function which worked for me.
To use the conditional code, paste the code below in your theme's functions.php or in your plugin functions file and use it like this:
if ( is_custom_page_template( 'template-name.php' ) ) {
// do something
} ]]>Mon, 22 Aug 2011 18:49:45 GMThttp://snipplr.com/view/58084/conditional-wordpress-function-to-detect-page-templates-when-the-page-is-used-to-display-posts-not-page-content/(HTML) If IE7 - amandalainehttp://snipplr.com/view/56826/if-ie7/
]]>Tue, 19 Jul 2011 01:56:11 GMThttp://snipplr.com/view/56826/if-ie7/(CSS) IE Conditional Statements - pleshhttp://snipplr.com/view/56271/ie-conditional-statements/
Enables you to easily select older version of CSS by class rather than having a seperate CSS file for each version of IE. ]]>Fri, 08 Jul 2011 01:44:47 GMThttp://snipplr.com/view/56271/ie-conditional-statements/(jQuery) Conditional JQuery Validate Required Field - dan_hoerrhttp://snipplr.com/view/55592/conditional-jquery-validate-required-field/
]]>Wed, 22 Jun 2011 23:26:25 GMThttp://snipplr.com/view/55592/conditional-jquery-validate-required-field/(PHP) ExpressionEngine if Statement - ryarwoodhttp://snipplr.com/view/55061/expressionengine-if-statement/
]]>Thu, 09 Jun 2011 05:25:16 GMThttp://snipplr.com/view/55061/expressionengine-if-statement/(PHP) ExpressionEngine Ghetto SEO Method - ryarwoodhttp://snipplr.com/view/55048/expressionengine-ghetto-seo-method/
]]>Thu, 09 Jun 2011 04:28:06 GMThttp://snipplr.com/view/55048/expressionengine-ghetto-seo-method/(C#) System Object extensions for easier conditionals (Extending Base Object Types) - bryanlymanhttp://snipplr.com/view/53894/system-object-extensions-for-easier-conditionals-extending-base-object-types/
.net 3.0+, To create stability in your code, you must check all inputs into a method to make sure they are valid . Often people overlook this step because of laziness, or because they aren't convinced that exceptions and assertions are actually in place to help you instead of cause you a headache. Here are some extensions which can be used to enhance the System.Object class so that their methods are global to all classes; this makes input checking effortless. This is also somewhat generic in nature because the extensions take no class type in to account before they are called, but we can use type checking to perform different boxing (casting) operations. Sadly this cannot be done in VB.net because late binding restrictions do not allow the Object class to be extended (See my VB.Net example for further information). ]]>Sat, 21 May 2011 02:48:17 GMThttp://snipplr.com/view/53894/system-object-extensions-for-easier-conditionals-extending-base-object-types/(HTML) Conditional Body Tag for Drupal 7 - marshallgmoorehttp://snipplr.com/view/52289/conditional-body-tag-for-drupal-7/
Haven't fully tested this yet. ]]>Tue, 19 Apr 2011 04:55:22 GMThttp://snipplr.com/view/52289/conditional-body-tag-for-drupal-7/(Rails) Shoulda with TestUnit: Conditional Validation using Shoulda/Subject - widescapehttp://snipplr.com/view/49991/shoulda-with-testunit-conditional-validation-using-shouldasubject/
]]>Thu, 03 Mar 2011 21:46:02 GMThttp://snipplr.com/view/49991/shoulda-with-testunit-conditional-validation-using-shouldasubject/