What are Conditional Tags in WordPress?
January 31, 2021

The Conditional Tags are used to change what content is displayed and how that content is displayed. We can also check if that page matches some conditions.

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.

All of the Conditional Tags test to see whether a certain condition is met, and then returns either TRUE or FALSE.

Some of the Conditional Tags can accept parameters as well.

Some of the Conditional Tags examples.


We can check when if main blog page is being displayed using this tag.

This is the page which shows the time based blog content of your site, so if you’ve set a static Page for the Front Page, then this will only be true on the Page which you set as the “Posts page” in Administration > Settings > Reading.


Using this tag we can check when the front of the site is displayed, whether it is posts or a Page.

It returns TRUE

✔ when the main blog page is being displayed and the ‘Settings > Reading ->Front page displays’ is set to “Your latest posts”,


✔ when ‘Settings > Reading ->Front page displays’ is set to “A static page” and the “Front Page” value is the current Page being displayed

Credit: WordPress Dev


Leave a Reply

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 How to set opacity or transparency using CSS? #3 Pagination in CSS with multiple examples #4 How to make HTML form interactive and using CSS? #5 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #6 How to uninstall Cocoapods from the Mac OS?

Recently Posted

Mar 5 How to create flickering text using CSS? Mar 4 How to use data-* Attributes in HTML? Mar 4 The substr() method in JavaScript and how it’s different from substring() Mar 4 A complete guide to add responsive YouTube videos using HTML and CSS Mar 3 How to embed YouTube or other video links in WordPress? Mar 3 How to change the Login Logo in WordPress?

You might also like these

How to use data-* Attributes in HTML?HTMLHow to catch .keypress() on body using jQuery?jQueryHow to show slider value in HTML5 range input using JavaScript?HTMLHow to detect the Blog Page in WordPress?WordPressHow to read Standard Input in Swift?SwiftClearwater Seafoods – B2C in ChinaMisc