WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Remove menu from blog page (posts page) (2 posts)

  1. budlix
    Member
    Posted 8 months ago #

    Hello,
    last days I am confused from trying remove menu list of pages (div.menu) from my posts page.

    I'm using BlankSlate theme and for menus I added function for MenuName, so I can have different menu on each page where MenuName is (custom field).

    Everything works fine except posts page, where is still showing list of pages I have created in wp.

    It looks like the posts page is "computed" different than other pages, so it ignores MenuName or what..

    Here is my posts page test:
    http://test.budlix.cz/blog/ (my static page named blog have MenuName custom field, same as here, where it works fine: http://test.budlix.cz/)

    Here is page with menu called with MenuName through custom field.
    http://test.budlix.cz/t-shirt/

    Please note: Main menu is hard-coded, what I'm solving is secondary menu which is different on each page or is not showing.

    Thank you very much for any response!

  2. budlix
    Member
    Posted 8 months ago #

    SOLVED

    This was my process:

    File: header.php
    Original Code Line: <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
    Revised Code Line: <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary', 'menu' => get_post_meta( $post->ID, 'MenuName', true) ) );?>
    Also: "Then create a new custom field called MenuName and give it a value matching the name of the menu you want that page to use."

    Solved - just moved code from header.php into page.php

Reply

You must log in to post.

About this Topic