WordPress Conditional Tags

On most situation in a wordpress theme you want to display content on the basis of page. Like display a slider only on home page or display a 468×60 banner only on single post page.

In such situations wordpress conditional tags are used to display content on the basis of the conditional tags.

So if you want to display my wordpress content slide plugin on home page and this home page is using default page template.

then you have to add following code

1
2
3
4
5
6
<?php
if(is_front_page())
{
if(function_exists('wp_content_slider')) { wp_content_slider(); }
}
?>

so after that slider will be added only on home page.

Read Also :  Best Wordpress Themes Recommendation

is_home()
is_single()
is_page()
is_category()
is_author()
is_date()
is_front_page()
in_the_loop()
is_year()
is_month()
is_day()
is_time()
is_archive()
is_search()
is_paged()
is_404()

Be the first to comment

Leave a Reply

Your email address will not be published.


*