• Resolved jasotasticon

    (@jasotasticon)


    I am having an issue getting my current_page_item class to apply to my “posts” page.

    It is working correctly with all my other pages.

    Perhaps it has something to do with the fact that I made my front page a static page and my posts page secondary?

    here is the code (the posts page is called “news”)

    <div id=”mainmenu”>
    <li class=”menu_item menu_studio <?php if (is_page(‘studio’)) { echo “current_page_item”; }?>”>
    <li class=”menu_item menu_news <?php if (is_page(‘news’)) { echo “current_page_item”; }?>”>
    <li class=”menu_item menu_biocv <?php if (is_page(‘bio_cv’)) { echo “current_page_item”; }?>”>
    </div>

    I tried for a while to echo the current page as text in the html so I could correctly identify the “posts” page. Was not successful.

    I am very very new to wordpress and any help would be greatly appreciated.

    THANKS!
    – J

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try using is_home() instead of is_page() if you’ve set the News page as your posts page.

    Thread Starter jasotasticon

    (@jasotasticon)

    That did it!

    Thanks much appreciated!

    – J

    i am having a similar problem:
    My conditional statement works for all cases except arts-entertainment page. Below is my code, any help would be appreciated.

    ===================

    <?php
    if ( in_category(‘news’) || post_is_in_descendant_category( 13 ) ) {
    include ‘includes/nav-home.php’;
    }
    elseif ( in_category(‘business’) || post_is_in_descendant_category( 14 ) || is_page(‘business’)) {
    include ‘includes/nav-bus.php’;
    }
    elseif ( in_category(‘arts-entertainment’) || post_is_in_descendant_category( 17 ) || is_page(‘arts-entertainment’)) {
    include ‘includes/nav-ent.php’;
    }
    elseif ( in_category(‘living’) || post_is_in_descendant_category( 19 ) || is_page(‘living’)) {
    include ‘includes/nav-liv.php’;
    }
    elseif ( in_category(‘opinion’) || post_is_in_descendant_category( 18 ) || is_page(‘opinion’)) {
    include ‘includes/nav-opn.php’;
    }
    elseif ( in_category(‘sports’) || post_is_in_descendant_category( 20 ) || is_page(‘sports’)) {
    include ‘includes/nav-spt.php’;
    }
    else {
    include ‘includes/nav-home.php’;
    }
    ?>

    ==================
    FYI: The idea is to use a different color for navigation for each page in the conditional statement.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘is_page not working for “posts” page’ is closed to new replies.