Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #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,
    Florian

    #1336898

    Also 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.

    #1336997

    Hi,

    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,
    Ismael

    #1337732

    Thanks 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,
    Florian

    #1337848

    Hi,
    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,
    Mike

    #1340817

    Hello 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,
    Florian

    #1340820

    Hi,
    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

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