WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_pages highlight current page in single.php template (3 posts)

  1. Lee
    Member
    Posted 9 months ago #

    Im using wp_list_pages throughout my site in a sidebar to list the child pages of the current page. The current page item feature works fine when i click one of these child pages but when i click into a post, in the single.php template, it dosen't highlight what page the post is under, the current page item class disappears. Does anyone know a way around this?

  2. Zoe Rooney
    Member
    Posted 9 months ago #

    That's because posts aren't in the page hierarchy. How would it know/ how are you telling it what page should be the parent of the post?

  3. Lee
    Member
    Posted 9 months ago #

    Well, if i change my reading settings, post page to one of the child pages i need highlighted, e.g blog, when i click into a single post in the blog page, it adds the current_page_item class inside the single.php template, but it only works for that one page, so, if it can do it that way, one can only hope that there is another method that targets all the pages rather than the one that i manually select

Reply

You must log in to post.

About this Topic