-
AuthorPosts
-
January 24, 2022 at 1:18 pm #1336895
Dear Enfold-Support,
i would like to create a notification bar as outline here: https://kriesi.at/documentation/enfold/example-of-a-notification-bar-on-top/#toggle-id-1.
When reading the requirement “Enfold > Header > Header Layout > Menu and Logo Position > Logo left, Menu right” i have doubts how I could realize it, as i have “Enfold > Header > Header Layout > Menu and Logo Position > Logo center, Menu below” set for my website.Maybe I do not understand it correctly., but I think changing the setting “Logo center, Menu below” is not an option for my website, or is it? Please find the link to the website in the private content.
Moreover the settings for the CSS seem super invasive…is it possible to preserve the layout of the header as is AND have a notification bar on top?Kind regards,
FlorianJanuary 24, 2022 at 1:27 pm #1336898Also when trying to do achieve the bar with “Adding a header widget area” at https://kriesi.at/documentation/enfold/header/ it appears below the secondary menu instead of the desired layout being above the secondary menu.
January 25, 2022 at 9:15 am #1336997Hi,
Thank you for the inquiry.
Instead of adding a widget, you can use this code in the functions.php file to insert another element (a banner, notification bar etc) above the logo container.
add_action("ava_main_header", function() { $banner = "<div id='banner'>This is a banner</div>"; echo $banner; }, 10);
You can then add this css code to style it a bit.
.responsive #top #header_main #banner { width: 100%; height: 30px; background: red; text-align: center; }
Best regards,
IsmaelJanuary 28, 2022 at 2:41 pm #1337732Thanks Ismael!
I tried that out – and unfortunately with the code in the functions.php it’s appearing below the secondary menu, instead of right on top. Do you have any advice to fix that?Kind regards,
FlorianJanuary 29, 2022 at 7:24 pm #1337848Hi,
Please try this code in your functions.php instead:function custom_top_banner() { ?> <script> (function($){ $( "<div id='banner'>This is a banner</div>" ).insertBefore( "#header_meta" ); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_top_banner');
and this css instead:
.responsive #top #header > #banner { width: 100%; height: 30px; background: #ffff00; color: #000; text-align: center; z-index: 1; position: relative; } .html_header_top.html_header_topbar_active.html_header_sticky #top #main > .title_container { padding-top: 30px; }
After applying the css, please clear your browser cache and check.
Best regards,
MikeFebruary 16, 2022 at 1:32 am #1340817Hello Mike!
Thanks & apologies for only coming back to it now.
Adding the code to functions.php and to QuickCSS no top banner at all is displayed unfortunately. It doesn’t seem to do have any effect. I have cleared the browser cache.
Could you double-check the code if everything is correct?Thank a lot!
Kind regards,
FlorianFebruary 16, 2022 at 1:54 am #1340820Hi,
You are getting the jQuery is not defined error, do you have the Enfold Theme Options ▸ Performance ▸ Load jQuery in your footer option enabled?
Try this script instead:function custom_top_banner() { ?> <script> window.addEventListener('DOMContentLoaded', function() { (function($){ $( "<div id='banner'>This is a banner</div>" ).insertBefore( "#header_meta" ); })(jQuery); }); </script> <?php } add_action('wp_footer', 'custom_top_banner');
but use the same css from above.
Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.