-
AuthorPosts
-
November 25, 2016 at 2:15 pm #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.November 28, 2016 at 7:52 am #717599Hey 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!
IsmaelDecember 1, 2016 at 12:03 pm #719201Hi Ismael,
I will try that. Is it in the header.php that I add the code snippet?
Thanks,
NadeaDecember 2, 2016 at 5:29 am #719496Hi Nadea,
No, please try it in your functions.php file. You can find it under Appearance->Editor.
Best regards,
RikardDecember 2, 2016 at 10:47 am #719590Hi,
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,
NadeaDecember 6, 2016 at 6:33 am #720850Hi,
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,
IsmaelDecember 12, 2016 at 3:30 pm #723177Hi 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
December 14, 2016 at 12:36 pm #724231Hi,
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,
AndyJanuary 10, 2017 at 3:11 pm #731576Hi,
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 cssThanks again,
Nadea
- This reply was modified 7 years, 11 months ago by NNE.
January 11, 2017 at 7:10 am #731899Hi 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,
RikardFebruary 13, 2017 at 3:26 pm #746458Hmmm 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.
- This reply was modified 7 years, 10 months ago by ninjaunmatched.
February 14, 2017 at 5:02 pm #746986Hi,
yes please open a new ticket for this new question. Thanks!
Best regards,
Andy -
AuthorPosts
- The topic ‘Header in code block’ is closed to new replies.