The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Wildcard for child categories in Dynamic Menu (2 posts)

  1. Darkt
    Posted 10 years ago #

    I need a wildcard for describing the subcategories, so that if the user browses a page in a subcategory of the main-category, main-category is highlighted in the menu:
    something like this:

    elseif ( is_page('main-category/*') ) { $current = '#nav_categories'; }

    I tried to replace the is_page function declaration with this:

    function is_page ($page = '') {
    global $wp_query;

    if ( !$wp_query->is_page )
    return false;

    if ( empty($page) )
    return true;

    $page_obj = $wp_query->get_queried_object();

    if ( strpos($page,$page_obj->ID)===true )
    return true;
    elseif (strpos($page,$page_obj->post_title)===true )
    return true;
    else if (strpos($page,$page_obj->post_name)===true )
    return true;

    return false;

    it did not work though!
    Any idea?

  2. Darkt
    Posted 10 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic