Sunteți pe pagina 1din 1

Conditional Tags for use with the Widget Logic plugin

Basic Tags
is_home() is_front_page() is_admin() is_sticky() is_sticky('83') is_post_type() is_page_template() is_date() is_year() is_month() is_day() is_time() is_archive() is_search() is_404() is_preview() is_paged() has_excerpt() has_excerpt('21') is_author() is_author('bill')
Main Page Front Page Admin Dashboard Sticky post Sticky post with id #83 WP 3.0 custom post types Is page template used When any date displayed When yearly archive displayed When monthly archive displayed When daily archive displayed When an hourly, minutely, secondly When any archive displayed When search results displayed When 404 page displayed When post displayed in Draft Mode If post is paged When current post has an excerpt When post with excerpt & id #21 When content written by author is shown When content written by 'bill' is shown

Single Post Page


is_single() is_single('5') is_single('Lotto Deal') is_single('lotto-deal') is_single(array(5,'lotto-deal','Lotto Deal')) is_single(array(3,7,13,82))
Any single post page Post id #5 displayed as single post Post with title 'Lotto Deal' displayed as single post Post with slug 'lotto-deal' displayed as single post Post with EITHER post id 5, 'lotto-deal' slug, or 'Lotto Deal' title Post with EITHER post id 3,7,13,82

Pages
is_page() is_page('33') is_page('About Us') is_page('about-us') is_page(array(33,'About Us','about-us'))
Any page displayed When page id #33 is displayed When page with title 'About Us' is displayed When page with slug 'about-us' is displayed When either page with post id #33, title 'About Us', or slug 'about-us'

Category Page
is_category() is_category('22') is_category('Chuck Norris') is_category('chuck-norris') is_category(array(22,'Chuck Norris', 'chuck-norris') in_category('9') in_category(array(1,2,3)) !in_category(array(1,2,3))
Any category page displayed When category id #22 is displayed When category with name 'Chuck Norris' is displayed When category with slug 'chuck-norris' is displayed When category has either id #22, title 'Chuck Norris', or slug 'chuck-norris Current post is in category id #9 Current post is in either category id #1, #2, #3 Current post is not in either category id #1, #2, #3

Multiple Conditions is_home() || is_single() is_single() && is_tag('blue')


The && demonstrates relationship/dependency The || demonstrate a split in conditional tags

Tag Page
is_tag() is_tag('joke') is_tag(array('joke','funny','lol')) has_tag('joke') has_tag(array('joke','funny','lol'))
Any tag page displayed When tag page has slug of 'joke' displayed When tag page has slug of either 'joke', 'funny', or 'lol' When post has the tag 'joke' When post has any of the tags

For more information and additional conditional tags please visit: http://codex.wordpress.org/Conditional_Tags

S-ar putea să vă placă și