Help adding custom menu to subpages

Basic support is open to all members of Volatyl Themes but what about those who need a little more? That's what Volatyl Themes subscriptions are for. The Priority Support subscription gets you more detailed, personal support while the Advanced Development subscription not only includes Priority Support, but also grants you access to premium content only seen by subscribers. This premium content will help you take your Volatyl websites to the next level with advanced development techniques, integration tips, and more information on how to really put Volatyl to use. Check out the subscriptions!

The Affordable WordPress Framework Forums Basic Support Child Theme Development Help adding custom menu to subpages

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  sdavis2702 4 years, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3943

    Peninah Adler
    Participant
    Post count: 5

    I’m working on a website that has a few submenus.
    You can see a sample above the page content here.

    Right now, I have it placed using this function:

    function alumae_menu() {
    if ( is_page( array( 6, 77, 74, 12, 96, 101 ) ) ) { ?>
    <?php wp_nav_menu( array( '$menu' => 'Alumnae menu', 'theme_location' => 'alumnae-menu', 'sort_column' => 'menu_order', 'container_class' => 'alum_menu main' ) ); ?>
    
    <?php }
    }
    add_action( 'vol_before_content_area', 'alumae_menu' );
    

    But I think listing all the sub-pages is messy, and I’d like something that would include all sub-pages of “Alumnae” (or page ID 6). I tried using

    if ( is_page( 'alumnae' ) || $post->post_parent == '6' )

    but it only works on the parent page. Am I missing any quick fixes?
    Thanks!

    #3947

    sdavis2702
    Keymaster
    Post count: 72

    Hey! I’m looking at your site now and trying to figure out exactly what it is you’re looking for. I do see the subpages listed in a menu above the content on the Alumnae page and all of its subpages. Did you figure it out already or is this not the desired result I’m seeing?

    #3946

    Peninah Adler
    Participant
    Post count: 5

    It is working, it’s just not as clean as I would like it.
    Right now, I have that array with each subpage listed. I would prefer it to be linked to the parent page. That way, every time a sub-page is added, it would automatically get this nav bar. The way I have it now, I have to go into the functions.php file each time I want to add a sub-page and add the page ID.

    #3945

    sdavis2702
    Keymaster
    Post count: 72

    Gotcha. Have you tried using get_page_children()? It seems to do exactly what you’re looking for. I have never used it myself but I see no reason why it wouldn’t return the results you’re trying to get without having to constantly go back and change parameters. I haven’t tried it myself because this isn’t really about Volatyl… it’s about WordPress. But I really think that should work. Let me know.

    #3944

    Peninah Adler
    Participant
    Post count: 5

    I’ll try that, thanks!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.