Forums

getting current URI (2 posts)

  1. Affian
    Member
    Posted 2 years ago #

    Is there a way to compare the current location of the browser to a string?
    I have a link that I want to style differently if you are currently on that page. The page in question is a category page so the normal get_post_uri() won't work.

    <li class="<?php if ($custom_menu['url'] == /*current URI*/) echo 'current_page_item'; ?>">
    <a href="<?php echo $custom_menu['url']; ?>">
    <?php _e($custom_menu['label'],TEMPLATE_DOMAIN); ?>
    </a>
    </li>
  2. Affian
    Member
    Posted 2 years ago #

    ok I've narrowed it down because wp_list_categories() does what I want, it highlights the the current category using
    $r['current_category'] = $wp_query->get_queried_object_id();

    I just can't figure out how it does it, I've been digging through source code and just can't find what I'm looking for.

Topic Closed

This topic has been closed to new replies.

About this Topic