• Thanks in advance for all your help and answers!
    I know how to use WordPress for the most part, but I don’t know much about the “behind-the-scenes” stuff.

    I am trying to create a custom navigation for my just my blog page (all the other pages will use the “primary_nav”) in which to put categories instead of pages. I have read the other posts on doing this, but I think its not working because its on the “blog” page (I’ve tried it on other pages, and it works fine.)

    here is my code:

    <?php if(is_page('blog')) wp_nav_menu( array( 'theme_location' => 'blog_navigation' ) ); ?>
    // Register Primary Navigation Menu
    	register_nav_menus(
    		array(
    			'primary_nav' => 'Primary Menu', // You can add more menus here
                            'blog_navigation' => 'Blog Navigation',
    		)
    	);

    I already created this menu under “menus” under “Appearance”.
    But every time I do this it just displays the “primary_nav” instead of the “blog_navigation”. You can see it here: N4moredesign.com/blog

    What am I doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try

    <?php if(is_page('blog')) { ?>
    	<?php wp_nav_menu( array( 'theme_location' => 'blog_navigation' ) ); ?>
    <?php } else { ?>
    	<?php wp_nav_menu( array( 'theme_location' => 'primary_nav' ) ); ?>
    <?php } ?>
    Thread Starter n4moredesign

    (@n4moredesign)

    Thank you Triptripper for your reply!
    I tried the code you provided, but it still does not display the “blog_navigation” menu on the blog page.

    So then, I tried this:

    <?php if(is_page('contact')) { ?>
    	<?php wp_nav_menu( array( 'theme_location' => 'blog_navigation' ) ); ?>
    <?php } else { ?>
    	<?php wp_nav_menu( array( 'theme_location' => 'primary_nav' ) ); ?>
    <?php } ?>

    (Notice the “contact”) And I went to the “contact” page and it displayed the “blog_navigation” menu. I then assigned the “contact” page as the “post page” under “Settings>Reading”and now it wont display the “blog_navigation” menu which makes me think the code is not working because its on the “post page” page.

    And now if you visit the Blog page it displays:

    Parse error: syntax error, unexpected '<' in /home/n4more/public_html/wp-content/themes/pinboard/template-blog.php on line 6

    What else should I try?

    I then assigned the “contact” page as the “post page” under “Settings>Reading”

    Use is_home() instead.

    https://codex.www.ads-software.com/Conditional_Tags#The_Main_Page

    Also, do all the editing in a Child Theme environment.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trouble creating a custom menu for blog page’ is closed to new replies.