Support » Themes and Templates » Custom page templates and current_page_item

  • Greetings boys and girls;

    An install I’m working on is using current_page_item to style a list of pages as a navigation menu, as seems pretty standard. The site uses a ‘normal’ front page (i.e. a list of recent posts, no special static frontpage selected).

    However, there’s a problem – two of those pages are using custom page templates, and when those templates are used, current_page_item isn’t passed. I thought it might be the second loop running after the page content loop causing the problem, but dummy versions minus the second loop still cause the same issue. Using the standard page template, current_page_item seems to work fine.

    Has anyone else encountered this little issue, and – more importantly – does anyone know a way around it? I’ve found hacks for similar problems caused by static front pages, but a) they’re messy, and b) they don’t address this problem, which seems to be simpler in origin (though I may be mistaken on that point, of course).

    Any suggestions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I have same problem. Any solution? Thanks

    could it be done by using conditional tags?

    <li class="<?php if (is_page('7') || $post->post_parent == '7' ){echo 'current_page_item';} ?>">link goes here</li>

    I have the same problem as this. Any updates?

    Same problem here. Conditional tags are no solution if you want to use the wp_list_pages function. If your going to hack, may as well just use css.

    As I’ve been researching, Ive seen that this issue was prevalent around a year ago, version 2.3 or thereabouts. The bug has resurfaced it seems.

    I am using 2.7.1



    Same problem using latest WP 2.8.1, latest K2 rc8 theme and latest version of Now Reading Reloaded. This plugin includes a custom page template. The current_page_item class gets applied to the Posts/Blog front page rather than the Library page.
    Does anyone have any working solution? Has the bug been submitted?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom page templates and current_page_item’ is closed to new replies.