• Kinda new at wp and trying to hard code different menus to different pages in my site by using:

    <?php if( is_page(‘129’) || is_child(‘129’) ) {
    wp_nav_menu( array( ‘menu’ => ’10’, ‘depth’ => 1 ) );
    } //vintagemenyn
    elseif(is_page(‘141’) || is_child(‘141’)) {
    wp_nav_menu( array( ‘menu’ => ’11’, ‘depth’ => 1 ) );
    } //retromassan
    else {
    wp_nav_menu( array(‘menu’ => ‘Hem’, ‘depth’ => 1 ) );
    } //alla andra
    ?>

    The function:

    function is_child ($parent) {
    global $wp_query;
    if ($wp_query->post->post_parent == $parent) {
    $return = true;
    }
    else {
    $return = false;
    }
    return $return;
    }

    My problem is that I also need to put the menu on the grandchildren of the pages, wich isn’t working right now. Can somebody help me? Thanks!

  • The topic ‘Menu – child and grandchild’ is closed to new replies.