Skip to content

Understanding is_singular() in WordPress Templates

This text and video Quick Guide explains how to use is_singular(), one of the more useful WordPress template tags. We also explain the difference between the is_singular() conditional tag, and the two other related ones: is_page() and is_single().

is_singular(): One of WordPress’s Conditional Template Tags

WordPress’s conditional tags are little functions that tell you something about the WordPress content being displayed on a page.

For example, is_archive() is another WordPress conditional tag, and it tells you if the content being displayed is a post archive: a list of posts from any WordPress post type, such as the front page of a blog section.

Our full article on WordPress conditional tags can help illuminate the concept, which is key to understanding how is_singular() itself works and what it’s useful for:

How to Use WordPress Conditional Tags

Understanding the Difference Between is_single(), is_singular(), and is_page()

To understand the WordPress conditional tag is_singular(), it’s useful to understand two related tags: is_page() and is_single().

All three tags relate to the condition where only one WordPress post is being displayed. Within that constraint:

  • is_page() will be true only if the piece of content being displayed is a single post of type Page.
  • is_single() is the confusing one. It will be true if the piece of content being displayed is a single post of any post type other than Page or Attachment.
  • is_singular() will be true no matter which the post type of the single piece of content being displayed.

So the three template tags work like this:

  • If the single post is of type Page, then is_page() is true, is_single() is false, and is_singular() is true.
  • If the single post is of type Post, then is_page() is false, is_single() is true, and is_singular() is true.
  • If the single post is of any other post type (a custom post type), then is_page() is false, is_single() is true, and is_singular() is true.

So, if either is_page() or is_single() conditional tags are true, is_singular will always be true.

But if you’re going to display more than one of any post type (including Post and Page), then all of the above conditional tags will be false.

Seeing it in Action: is_single() PHP authoring, with is_singular()

Using is_singular(): Make Something Disappear on Single-Entry HTML Pages

To use the conditional tag is_singular to make something appear when your theme is showing single page or post:

  1. First, find the part of the theme file, say footer.php that you want to control this way. This should be 1-100 lines of HTML and PHP code.
  2. Then, mindful of whether you’ve got PHP tags open or not, add the following line before the content you want to only show when is_singular is true: <?php if ( is_singular() ): ?>
  3. Then, add the following line after the content you want to only show in certain conditions: <?php endif; ?>.

Test it. It should work.

Quick note: saying not in PHP is usually done with a ! (often pronounced “bang” or “exclamation point”). So to show this in the opposite conditions, you’d change the code you added in step #2 to: <?php if ( !is_singular() ): ?>. The easiest way I know to read that is “if is not singular”, although it does literally read more like “if not is singular.” But that’s a little too Yoda-y for my brain.

Example Code Block for is_singular() in WordPress

Finally, if you’re helped by a big single code-block, here’s an example use of is_singular() in PHP:

<?php if ( is_singular() ): ?>
<h2>Popular posts</h2>
        <li><a href="">Course: Learn WordPress Development</a></li>
        <li><a href="">Complete Guide to WordPress Security</a></li>
        <li><a href="">WordPress Page Builders, Reviewed</a></li>
<?php endif; ?>

Serious About Learning WordPress Development?

Thanks for learning how is_singular() works in WordPress! If you’d like to understand the entire WordPress PHP ecosystem, and where WordPress template tags fit within it, we strongly recommend you check out our course Up and Running, which teaches WordPress development the clear, thorough, and quick way:

Learn WordPress Development!

Get Up and Running Today

Up and Running is our complete “learn WordPress development” course. Now in its updated and expanded Third Edition, it’s helped hundreds of happy buyers learn WordPress development the fast, smart, and thorough way.


I think anyone interested in learning WordPress development NEEDS this course.

Before I purchased Up and Running, I had taught myself some WordPress code, but lacked direction. Watching the course’s videos was like a bunch of lights being turned on.

I went from being vaguely familiar with how themes, functions and WordPress itself worked to mastering these. Everything became much clearer.

I very happily recommend this course to anyone willing to listen.”

–Jason Robie, WordPress developer

Take the next step in your WordPress development journey!

Yay! 🎉 You made it to the end of the article!
David Hayes

Inline Feedbacks
View all comments

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!

Would love your thoughts, please comment.x

Most Searched Articles

Best JavaScript Libraries and Frameworks: Try These 14 in 2024

In this post, we look at the best JavaScript libraries and frameworks to try out this year. Why? Well, with JavaScript being available in every web browser, this makes it the most accessible programming language of ...

20 Best Free WordPress Themes for 2024 (Responsive, Mobile-Ready, Beautiful)

If you're looking for only the best free WordPress themes in the market for this year, then you're in the right place. We have more than enough such themes for you right ...

12 Best WordPress Hosting Providers of 2024 Compared and Tested

Looking for the best WordPress hosting that you can actually afford? We did the testing for you. Here are 10+ best hosts on the market ...

Handpicked Articles

How to Make a WordPress Website: Ultimate Guide for All Users – Beginners, Intermediate, Advanced

Many people wonder how to make a WordPress website. They’ve heard about WordPress, its incredible popularity, excellent features and designs, and now they want to join the pack and build a WordPress website of their own. So, where does one get ...

How to Start an Ecommerce Business: Ultimate Guide for 2024

Is this going to be the year you learn how to start an eCommerce business from scratch? You’re certainly in the right place! This guide will give you a roadmap to getting from 0 to a fully functional eCommerce business. ...