[Support request] Use full width header and nav only on specified pages

Home Forums Support [Support request] Use full width header and nav only on specified pages

Home Forums Support Use full width header and nav only on specified pages

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #984508
    Fox

    Hi!

    I am trying to figure out how to use a full screen menu and nav on the main page (and several others), while keeping the contained one on archives and others.

    I was thinking of something along the lines of this topic, but as far as I understand the menu plus filter does not toggle the width settings, it’s one of the more basic features?

    Is there some kind of obvious solution that I’m missing? Or if not, could you please point me in the direction of the less obvious one?

    #984946
    Leo
    Staff
    Customer Support

    Hi there,

    I believe this filter should help:
    https://docs.generatepress.com/article/option_generate_settings/

    There is an example at the bottom of the page.

    Have a look and let me know if you need help with the code ๐Ÿ™‚

    #984983
    Fox

    Thank you so much, Leo, this is just what I was looking for! Your support here on GP is exemplary. Most questions I find answers to through searching the forums and docs, and when I can’t, you answer really promptly. Thank you.

    #984992
    Leo
    Staff
    Customer Support

    Thanks for the kind words! Always good to hear that ๐Ÿ™‚

    #985062
    Fox

    I have one more seemingly related question if that’s ok.

    When I add the filters to make header and nav full width that seems to unset a lot of the customizations I previously entered through the customizer.

    I am adding the code to my child theme’s functions.php, the snippet is the following:

    add_filter( 'option_generate_settings','lh_single_posts_settings' );
    function lh_single_posts_settings( $options ) {
        if ( is_front_page() ) {
            $options['header_layout_setting'] = 'fluid-header';
            $options['nav_layout_setting'] = 'fluid-nav';
           
    
        
        return $options;
    	}
    
    }

    Is there something I’m doing incorrectly that’s causing the issue? Or do I need to choose whether I’m using the customizer or doing things manually, but not both?

    I tried using an else to specify that the nav and header must be contained in all other cases, but that helped. But either way on all pages except for the main one I now also see the site title and the tagline (and the hide option is now unchecked in the customizer though it was previously checked), and adding code to hide them does not seem to help. And the layout has gone back to sith sidebar for some reason.
    Sorry if this is written in a confusing way, I am struggling with explaining it clearly.

    #985171
    Leo
    Staff
    Customer Support

    Can you try this?

    add_filter( 'option_generate_settings','lh_front_page_settings' );
    function lh_front_page_settings( $options ) {
        if ( is_front_page() ) {
            $options['header_layout_setting'] = 'fluid-header';
            $options['nav_layout_setting'] = 'fluid-nav';
        }
        
        return $options;
    }
    #985190
    Fox

    Thanks, that seems to work. The confusing part is it seems identical to what I posted (except for the function name, but that shouldn’t really matter).

    The only thing now is when I open the customizer it stops working, but as soon as I close the customizer it works again. But the title and tagline have stopped appearing, and all the other customizer settings reset themselves any more. So I think I’m good, thanks. =)

    #985197
    Leo
    Staff
    Customer Support

    The two functions aren’t identical. You had return $options; inside the if statement.

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