741 posts
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Had an item featured 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
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Had an item featured 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
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Had an item featured 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?? :|

443 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
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Had an item featured 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

by
by
by
by
by
by