• Im aware I can when I go to adda block to a page there is a navigation , but that only seems to show the primary menu.

    There is a list of widget blocks , but that does does not include the Navigation menu (which is available as a widget on the widget page but doesn’t seem to be listed as a block when I go to add a block to a page)

    I want to show other menus that aren’t the primary. So I know I can several widgets, each with their own navigation menu, but can I show those like blocks within different specific pages as opposed to the global widget areas?

    • This topic was modified 1 year, 2 months ago by Mr Lucky.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator bcworkz

    (@bcworkz)

    There should be a navigation block available in the page editor. It’s possible your theme or a plugin has removed or hidden it. You could selectively swap themes and deactivate plugins to identify which is responsible.

    While the default nav menu block will match that of your main menu, it’s not directly tied to your defined menus. It’s really just a container for different link blocks. You can add and remove links for this menu block as desired in the settings sidebar. Changes here will not reflect in your defined menus.

    Thread Starter Mr Lucky

    (@voodoochill)

    Yes there is a navigation block, but it doesn’t let me choose which menu – it seems to just be the primary menu.

    This is with theme Twenty Twenty Three and no plugins.

    What I’m after is like the navigation menu widget that allows you to choose which menu (presuming you have created other menus apart from just the one primary menu)

    • This reply was modified 1 year, 2 months ago by Mr Lucky.
    Moderator bcworkz

    (@bcworkz)

    When you insert a menu block, it uses your main menu as the default. It does not accept defined menu arguments, but you can directly alter the links within. As I said:

    …it’s not directly tied to your defined menus. It’s really just a container for different link blocks. You can add and remove links for this menu block as desired in the settings sidebar.

    Thread Starter Mr Lucky

    (@voodoochill)

    While the default nav menu block will match that of your main menu, it’s not directly tied to your defined menus. It’s really just a container for different link blocks. You can add and remove links for this menu block as desired in the settings sidebar. Changes here will not reflect in your defined menus

    OK, so it just creates a copy of your primary menu into the black, and you can then edit that.

    This might be a workaround except that it will be very very tedious as the site has a couple of hundred pages. I’d need to delete all the entries (one by one?) and then re-enter to recreate each of the other menus.

    But I can’t actually see how do I delete an item from the menu ???

    So I don’t see how I can use this easily (or at all) opposed to the navigation widget where you can just choose the menu you want. This would be ideal if only I could show the widget on a page.

    Moderator bcworkz

    (@bcworkz)

    You can build any menu you desire, then use it to create a pattern (AKA reusable block). You can then reuse the same menu block pattern multiple times. If you choose to sync your pattern, editing the menu in one place will alter all instances of the pattern.

    If your menu occurs at the very beginning or end of post content and it should occur on all or most pages, it’s usually better to include it in your header or footer instead of in the post’s content.

    Alternately, use the “the_content” filter hook to automatically inject your desired menu into post content every time any content is output. Conditional logic can be used to exclude the menu under certain arbitrary conditions.

    Thread Starter Mr Lucky

    (@voodoochill)

    Ok that is a very long and tedious process with a site this size and so many different menus.

    Also the menus in the blocks are not in sync with the actual menu – so if I change the menu in Appearnces > menus then it doesn’t change the block

    Thread Starter Mr Lucky

    (@voodoochill)

    You can build any menu you desire, then use it to create a pattern (AKA reusable block).

     

    I can’t seem to do that. I have seen instructions on reusable blocks, says there is an option under the three vertical dots on the right of the block but there is another there about reusable blocks or about patterns. It just has

    Copy, duplicate, copy styles, paste styles, Lock, move to and delete

    But I can presumably just copy and paste the html of the block instead?

    Conditional logic can be used to exclude the menu under certain arbitrary conditions.

    Please explain how to do that, thanks

    • This reply was modified 1 year, 2 months ago by Mr Lucky.
    • This reply was modified 1 year, 2 months ago by Mr Lucky.
    Moderator bcworkz

    (@bcworkz)

    I think you may be in a link element context menu instead of the navigation container’s. What’s the title of the block settings side bar? It should be “Navigation” and not some sort of link element. You may need to click on the little compass icon to get to the navigation container. Then you should see under its 3 dot icon an option for creating a reusable block.

    Conditionally outputting additional content by using the “the_content” filter means developing some custom PHP. There’s a generic example on the linked doc page. You’d place your menu’s HTML in the place where “I’m filtering the content inside the main loop” is used in the example.

    The example uses the esc_html__() translation function, which shouldn’t be used for complex HTML like a menu structure. Checking the condition that we’re inside the main loop in a single post is a good start. You can add or remove conditions as desired. For example, only include or exclude the menu for certain post IDs.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Show navigation widget on specific pages’ is closed to new replies.