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

    Hello,

    For one of the pages on our website I would like to add a header that is different from the header on the rest of the website. What I did is basically copy the html code from the main content header, edit it to show what I want it to show and paste it in a code block. It looks OK on load but when I scroll down, it goes behind the page content. I can’t figure out what I should do to make it work.
    I understand it’s really not the same as having the actual header, but for now we have all the content on 1 WordPress instead of having it on 3 and there is just 1 header for the whole WP.
    Thank you in advance.

    #717599

    Hey NNE!

    Thank you for using Enfold.

    It’s possible to apply a different header settings for a specific page by using a filter. What kind of header would you like to have on that page?

    add_filter('avf_header_setting_filter', 'avf_header_setting_filter_mod', 9999, 1);
    function avf_header_setting_filter_mod($header) {
    	if(!is_page(array(13))) return;
    	$header['header_position'] = 'header_top';
    	$header['header_layout']   = 'logo_left menu_right';
    	$header['header_class']    = str_replace("av_bottom_nav_disabled", "", $header['header_class']);
    	$header['header_class']    = str_replace("av_bottom_nav_header", "", $header['header_class']);
    	$header['header_class']    = str_replace("av_menu_left", "", $header['header_class']);
    	$header['header_class']   .= ' html_main_nav_header av_menu_right ';
    	$header['bottom_menu']     = '';
    	return $header;
    }
    

    The example above will set the header layout to “Logo left, menu right” for the page with the ID 13.

    Cheers!
    Ismael

    #719201

    Hi Ismael,

    I will try that. Is it in the header.php that I add the code snippet?

    Thanks,
    Nadea

    #719496

    Hi Nadea,

    No, please try it in your functions.php file. You can find it under Appearance->Editor.

    Best regards,
    Rikard

    #719590

    Hi,
    I added the snippet to the functions.php but I would like to know how to change what the header displays. I made another menu for it and I need to insert another logo. How do I do that?

    Thank you in advance,
    Nadea

    #720850

    Hi,

    I made another menu for it and I need to insert another logo.

    If you want to display a different menu in a specific page, you’ll have to use one of the following plugins.

    // https://wordpress.org/plugins/menu-items-visibility-control/
    // https://wordpress.org/plugins/zen-menu-logic/

    For the logo, use this filter.

    // https://kriesi.at/support/topic/replace-site-logo-on-one-page/#post-657563

    Best regards,
    Ismael

    #723177

    Hi Ismael,

    I tried the filter for the logo, it works perfectly well, thank you!

    As for the plugins, tried both and have an issue with both of them. But those are questions for the plugin authors.
    So, I went in and tried adding some custom css to change menu items visibility. Don’t know what I am doing wrong, but I still don’t manage to do what I want.

    For example, I changed the visibility of a menu item on a specific page:

    .page-id-5353 #menu-item-5389{
    	display: none;
    }

    At first it worked great, I was happy, but then I went on other pages that use the same menu item and it also disappeared. So I suppose there is a problem with my css declaration somewhere. Don’t know how to style a specific element on a specific page of the website.
    Can you see where it went wrong?

    Thank you,

    Nadea

    #724231

    Hi,

    your code seems to be right, however, make sure you’re using the right page-id. Refer to this page for more information on how to find it: http://www.wpbeginner.com/beginners-guide/how-to-find-post-category-tag-comments-or-user-id-in-wordpress/

    Best regards,
    Andy

    #731576

    Hi,

    The page id was correct. I think it wasn’t working because of the language options. I’ll try adding the code using quick CSS each time in a different language and see if it works.

    Update: It worked!
    I was editing the custom.css file and it was applying the new rule to the whole website.
    Today I made some minor styling to other elements and used the quick css from Enfold>General Styling, then translated the page the element was on and saw that it didn’t work. I went back to General styling and saw that it has quick css for each language. I added the new rules there too and it worked.
    Same for the menu items. Different language = different css

    Thanks again,

    Nadea

    • This reply was modified 7 years, 2 months ago by NNE.
    #731899

    Hi Nadea,

    Great, glad you got it working and thanks for the feedback. Please let us know if you should need any further help on the topic.

    Best regards,
    Rikard

    #746458

    Hmmm could I use this for a meta decription for the page you use for bbpress? (The page where bbpress shortocode is) I’m catching errors of og:description not being defined even though I did add one in Yoast SEO. I want to change the title too. It keep picking up Forum Archive……..blah blah then for decription it is just picks up the first valid description it finds from one of the single forums.

    Or should this be asked in Separate thread?

    Update

    I figured it out. I had the Forum root slug set same as the page slug.

    #746986

    Hi,

    yes please open a new ticket for this new question. Thanks!

    Best regards,
    Andy

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Header in code block’ is closed to new replies.