Forums

[resolved] change css class based on url or page id (2 posts)

  1. craigabailey
    Member
    Posted 2 years ago #

    Hi,

    I have a list item as a menu in my header.php file. I need a php function that allows me to set the class of the anchor tag to "active" based on which page/URL is currently loaded. I don't mind if this is done by page ID, although would prefer to use URL so that I could have custom permalinks of domain/%postname%.

    Any ideas welcome. So far I can get it to set all pages of a certain ID to active but that must mean I have got my statement being true no matter what page you are on.

    Hope that makes sense?

    Thanks in advance...

  2. craigabailey
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic