Conditional Tags « WordPress Codex - 0 views
-
The Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches. For example, you might want to display a snippet of text above the series of posts, but only on the main page of your blog. With the is_home() Conditional Tag, that task is made easy.
-
is_single() When any single Post (or attachment, or custom Post Type) page is being displayed. (False for Pages)
-
Great for use with the Widget Logic plugin. A reference for all the conditional tags that help you restrict a widgets viewing.
-
Warning: You can only use conditional query tags on or after the init action hook in WordPress. For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php, i.e. outside of a function.