• I use the following code to highlight a menu item if the post is in this category or the category is selected:

    <a href="/category/presets/photoshop_actions" title="Only Photosshop Actions"
            <?php if (is_category(photoshop_actions) || is_single() && in_category('47')) {
                echo ' class="rounded rounded_active" ';}
                else{
                echo ' class="rounded" ';}
            ?>
            >
            <span>
                Photoshop Actions
            </span>
        </a>

    So here is the deal: I also want to have the rounded_active class set if there has been performed a search in the category – lets say the url looks like this when the search has been performed: http://localhost:8888/?cat=47&s=boats How do I expand the code above to check if category with id 47 is part of the search query and then echo back

    class="rounded rounded_active"

  • The topic ‘Highlight menu item if category has been searched’ is closed to new replies.