• 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>
Viewing 1 replies (of 1 total)
  • Thread Starter affian

    (@affian)

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘getting current URI’ is closed to new replies.