Support » Fixing WordPress » Dynamic links – assign ID/class

  • Currently I am using this to determine the title of a PAGE and assign an ID – if it’s something do this, if not, do something else:

    <h3<?php if (is_page('PAGE NAME'))
                    echo " id=\"current\"";
                    }?>><a href="PAGE NAME">PAGE NAME</a></h3>

    This works fine for fixed links.

    My question is:
    How do I do the same for dynamic links to POSTS using this:

    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>


Viewing 4 replies - 1 through 4 (of 4 total)
  • Seriously, no-one?

    i am having similar issues…. its seems to be severely lacking this ability.

    Are you trying to set a current page class to your links? WordPress already does this when you use wp_list_pages and wp_list_categories. It already knows what page you’re on, and will assign a “current-page-item” or “current-cat-item” class to the link associated with it.

    Is that what you’re trying to do?

    I hate to hi-jack a thread but here is the link to my thread explaining exactly what I was trying to do… LINK

    You can reply here that would be awesome. or on mine. or on both. I have static and dynamic links on my page in an <ul> I would like to be able to have 5 static links on every page and then have the ability to dynamically bring in 1 to 5 other links.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Dynamic links – assign ID/class’ is closed to new replies.