• I’ve got a static home page that is pulling posts from a particular category (“Press Release”). There is also a “blog” page that pulls posts from a different category. The client wants to have selected posts from the blog category show also be included on the home page. I’ve got that working.

    Here’s my question/issue. The client also wants to have the author name show on the blog page articles, but not on the home page. What I’m trying to do is to have a conditional in the post.php page that includes the_author, but to not do so if the post is on the home page.

    I tried this:
    <?php if(in_category('11') && !is_home()) { ?>

    This did not work…the author name still shows on the home page. I tried using is_front_page() instead and still the same…author shows.

    Out of curiosity, I tried inserting some random content on the page using something like:

    <php if(is_home()) { ?> <span>Hello world</span> <?php } ?>
    <php if(is_frong-page()) { ?> <span>Hello world</span> <?php } ?>

    Nothing! This leads to my question: is there some reason you can’t detect a page in the post.php code? I also tried a page id, which didn’t work.

  • The topic ‘Detecting page in post.php?’ is closed to new replies.