[Resolved] primary menu inside the content

Home Forums Support [Resolved] primary menu inside the content

Home Forums Support primary menu inside the content

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #851483
    Daniele

    Hi all,
    I’m tring to find a solution to put my primary menu inside the content.
    as here: http://www.80s.it/wp-content/uploads/2019/03/Senza-titolo-2.png

    any idea?
    tnx in advance,

    Daniele

    #851875
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    This should be pretty easy.

    Try this PHP:

    add_filter( 'generate_navigation_location', function() {
    	return 'custom';
    } );
    
    add_action( 'generate_before_main_content', function() {
    	if ( function_exists( 'generate_navigation_position' ) ) {
    		generate_navigation_position();
    	}
    }, 1 );
    #851953
    Daniele

    Hi Tom,
    it seems working properly just on pages (please see http://www.80s.it/contatti/ ) but on the homepage the menu is hidden by the content and in blog pages the menu is showed in the header.

    I tried to put your code in a hook (i thought the hook would be the easiest way to show the menu, even because in the future i could choose to use it on the top of the sidebars) but it doesn’t work at all…

    #852633
    Tom
    Lead Developer
    Lead Developer

    I just updated the code above – can you give it another shot?

    It should be added using one of these methods: https://docs.generatepress.com/article/adding-php/

    #852745
    Daniele

    ๐Ÿ˜€ It is just as perfect as usual.

    Just to be clear, i’ve added the code inside the functions.php file, but i was just figuring out if that code, modified like that

    
    add_filter( 'generate_navigation_location', function() {
    	return 'custom';
    } );
    
    add_action( 'generate_before_right_sidebar', function() {
    	if ( function_exists( 'generate_navigation_position' ) ) {
    		generate_navigation_position();
    	}
    }, 1 );

    would easily work as well in other part of the website using hooks.
    I’ll try.

    Thanks again and have a nice day,
    Daniele

    #852906
    Tom
    Lead Developer
    Lead Developer

    Glad I could help! ๐Ÿ™‚

    #1665963
    Gulf State Software

    This code is not working for my themes. This is the website https://www.gulfstatesoftware.com/.
    First I use function.php then I’m using code snippet. But nothing works.
    -Thanks

    #1666041
    Leo
    Staff
    Customer Support

    Do you have the navigation as a header option enabled?

    If so can you disable it first?
    https://docs.generatepress.com/article/navigation-as-a-header/

    #1666111
    Gulf State Software

    Looks like process is change with the development of theme.
    -Thanks a lot.

    #1666123
    Leo
    Staff
    Customer Support

    Sounds good.

    #1671372
    Gulf State Software

    Sorry , I disable the navigation header , but now if I past the code in function.php, they navigation bar went out.

    #1671716
    David
    Staff
    Customer Support

    Hi there,

    this is quite an old topic and since then there have been some changes… and i am not sure if that code is what you would need today – the code is removing the nav from its current location and placing it before the Right Sidebar… which your site is not using.

    Could you raise a new topic and explain exactly where you want the navigation to be positioned and we’ll work that out

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.