741 posts
  • Had an item featured on Envato Market
  • Won a Most Wanted contest
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
+4 more
Orbital_Themes says

So… I have a conditional statement in my sidebar.php that goes like this: if( is_home() ), everyone’s familiar with it, right?

Please tell me guys, why the hell it works well on pages with default page template, but when I choose “Blog” (my custom) page template, the conditional statement returns true :O

I will appreciate any help as I’m struggling with this for some time now :)

1479 posts The right tools with none of the gimmicks
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+6 more
PixelBin says

Did you so happen to choose that page as your static home page? ;)

741 posts
  • Had an item featured on Envato Market
  • Won a Most Wanted contest
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
+4 more
Orbital_Themes says
Did you so happen to choose that page as your static home page? ;)

Heh nope ;p when I change the template to default everything works as it should. The same happens for every other pages.

76 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
duane_ashworth says

i believe that when you change your homepage to a static one wordpress uses the index.php or home.php to provide the template for that page rather than the one you include in your pages properties.

Maybe make sure that the conditional appears in one of these pages to make it work.

374 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
_rohan says

is_home() returns true on your posts page. This could mean:

1. Homepage when Settings>Reading says ‘Show my latest posts’

2. Blog page when Settings>Reading uses a static homepage and the same blog page for latest posts.

741 posts
  • Had an item featured on Envato Market
  • Won a Most Wanted contest
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
+4 more
Orbital_Themes says

My Settings>Reading “Front page displays” is set to “Your latest posts”. I use a custom page template with custom query that queries posts with post type of blog. No matter which page (be it a about, contact or blog) I set to “Blog” page template, the is_home() returns true. I will try and create any other page template and see what happens then.

Any more ideas?

UPDATE :

When I delete custom query from my blog.php file everything goes back to normal, but then why would I need a blog page template without posts on it? And why the f* would custom query make a difference while checking for homepage?? :|

450 posts Don't be a HATER!
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+5 more
webinpixels says
try to reset your query post mate

//custom query here

wp_reset_query(); //reset the query

hope this help :)

741 posts
  • Had an item featured on Envato Market
  • Won a Most Wanted contest
  • Has been part of the Envato Community for over 5 years
  • Has sold $40,000+ on Envato Market
+4 more
Orbital_Themes says
try to reset your query post mate

//custom query here

wp_reset_query(); //reset the query
hope this help :)

You rock mate…!!! Thanks a lot! Worked like a charm :D

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by