[Support request] menu customization

Home Forums Support [Support request] menu customization

Home Forums Support menu customization

Viewing 15 posts - 16 through 30 (of 38 total)
  • Author
    Posts
  • #1384945
    Tom
    Lead Developer
    Lead Developer

    Try this:

    add_filter( 'option_generate_menu_plus_settings', function( $options ) {
        if ( is_singular( 'product' ) ) {
            $options['sticky_menu'] = 'false';
            $options['mobile_header'] = 'enable';
            $options['mobile_header_sticky'] = 'enable';
            $options['mobile_header_auto_hide_sticky'] = 'false';
        }
        
        return $options;
    } );

    To fix the sticky issue, you could try this:

    add_action( 'wp', function() {
        remove_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 7 );
        add_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 8 );
    } );
    #1384956
    Jeffrey

    ok, I implemented the code.

    The main nav is still sticky, and it moved the sub menu below the header element. Seems to have separated the menus in some way. Maybe you can check the products page to see?

    Really appreciate the php help ๐Ÿ™‚

    #1385069
    Tom
    Lead Developer
    Lead Developer

    Just tweaked the code a bit, can you give it another try?: https://generatepress.com/forums/topic/menu-customization-3/page/2/#post-1384945

    #1385098
    Jeffrey

    no go, still in the same spots.. left it up and added a page if that helps. Is there anything my green thumb can do to help?

    #1386011
    Tom
    Lead Developer
    Lead Developer

    Tricky one as I haven’t left a lot of room to breathe with the priorities in the plugin. Just made another tweak to the second function above – better?

    #1386082
    Jeffrey

    yes better, but just really back to the default behavior. When I disable the snippets it seems to be the same. Maybe it wont be possible the way its written? If not, could I pay for a rewrite from you possibly?

    #1386236
    Tom
    Lead Developer
    Lead Developer

    Yea, that method won’t work unfortunately. The issue is coming from the merged header – is it necessary on this page? If you un-merge the header, it should work as-is.

    #1386283
    Jeffrey

    Not necessary, totally down to un-merge the header for the page to work right, which version of the code should I use though, tried the last one as is, and no go.

    #1386286
    Tom
    Lead Developer
    Lead Developer

    You shouldn’t need the second function at all if you un-merge the header. You’ll just need the code that David gave you, and the updated first function I provided above.

    #1386295
    Jeffrey

    oh, maybe the problem is that I made a custom product page.

    It is working on the product page itself and looks awesome (if you click the sub nav product/book), but I also want it to work on any and all pages I add submenus too. Is that possible?

    #1386342
    Jeffrey

    or I figured I could do this…and it only displays on pages specified.

    add_filter( 'option_generate_menu_plus_settings', function( $options ) {
      if ( is_page( array( 375, 522 ) ) ) {
            $options['sticky_menu'] = 'false';
            $options['mobile_header'] = 'enable';
            $options['mobile_header_sticky'] = 'enable';
            $options['mobile_header_auto_hide_sticky'] = 'false';
        }
        
        return $options;
    } );
    #1386364
    Jeffrey

    however, it moves the header image down which is normal i assume. Is there a way to have the header element directly under the main navigation as if the secondary was not there. I’m using a transparent background kinda thing.

    And the above code works on pages, but what if I wanted to have it also work on the product pages, like you had it?

    and..

    Just noticed the woocomerce site-wide notice now overlaps the primary navigation, is there a way to move that on top again?

    Sorry for all the edits ๐Ÿ™‚

    #1386865
    David
    Staff
    Customer Support

    You can use the || OR operand in your condtion. This will apply to Product or those specific pages.

    if ( is_singular( 'product' ) || is_page( array( 375, 522 ) ) ) {

    You can use this CSS to move the header element up if the secondary nav is present:

    .secondary-navigation + .page-hero {
        margin-top: -62px;
    }

    You will need to ensure the header element has sufficient padding/quite space so the nav doesn’t overlap its content.

    #1386867
    Jeffrey

    Hey I just added to that last message sorry I will implement the above now.

    “Just noticed the woocomerce site-wide notice now overlaps the primary navigation, is there a way to move that on top again?”

    #1386886
    David
    Staff
    Customer Support

    Add this snippet to move the notice above the header:

    add_action( 'after_setup_theme', function() {
        remove_action( 'wp_footer' , 'woocommerce_demo_store', 10);
        add_action( 'generate_before_header' , 'woocommerce_demo_store' , 1);
    });

    And this CSS to stop it overlapping:

    .woocommerce-store-notice, p.demo_store {
        position: static;
    }
Viewing 15 posts - 16 through 30 (of 38 total)
  • You must be logged in to reply to this topic.