WordPress.org

Forums

[resolved] Dynamic Highlighting Blog Page and Children (2 posts)

  1. mrjohnsly
    Member
    Posted 5 years ago #

    Hi.

    I've just started using WordPress for the first time.

    I started off with...

    <li<?php if (is_page('blog')){ echo " class=\"current\"";}?>><a href="http://domain.com/blog/">Blog</a></li>

    Which after some searching on the forum I realised I needed to change it to...

    <li<?php if (is_home()){ echo " class=\"current\"";}?>><a href="http://domain.com/blog/">Blog</a></li>

    But I'm having trouble finding out how to keep the menu item highlighted for all the blog posts as well.

    Thanks in advanced to anyone who can point me in the right direction.

    mr.sly x

  2. mrjohnsly
    Member
    Posted 5 years ago #

    Never mind fixed it. :

    For anyone searching who might want the same fix...

    <li<?php if (is_home()|| is_single()) { echo " class=\"current\"";}?>><a href="http://mrjohnsly.co.uk/blog/">Blog</a></li>

Topic Closed

This topic has been closed to new replies.

About this Topic