The blog

I'll try to keep it brief

Posted by Thomas on December 5, 2013

WordPress Widget Logic code for homepage only (not paginated pages)

If like many other people you use the excellent Widget Logic to control which URLs your sidebar content displays on, this may come in handy for you.

How do I know this?

I just spent a solid 2 hours looking for it myself!

If you want content to appear on the homepage only the code to enter into the Widget Logic field is:


Everyone knows that though, right?

Well, if you display your latest posts on the homepage and only want a particular widget to display on the front page not paginated versions e.g.

Then the code you need is this:

is_home() && $post==$posts[0] && !is_paged()

Hope that helps someone out! :)

Ping me a comment if you make good use of it. Always cool to know.