Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1402801

    Hi,

    I’m using the following function in my functions.php to insert a coloured bar just after <!– close default .container_wrap element –> and before the footer <div class=”container_wrap footer_color” id=”footer”>

    /* Add content just before the footer */
    add_action('get_footer', 'colour_bar');
    function colour_bar() {
      $content = '<div id="de-footer-bar">
    	<div class="de-colour green"></div>
    	<div class="de-colour blue"></div>
    	<div class="de-colour purple"></div>
    	<div class="de-colour orange"></div>
    </div>';
      echo $content;
    }

    This works fine on all pages unless the last element on the page is a color section. When a color section is used, the get_footer HTML content is present but not visible.

    I’ve tried adding bottom padding and margin and a few other things but have run out of ideas.

    Thanks for your help.

    #1402826

    why don’t you solve it by just css – and make that “separator” part of the footer itself?
    and if this separator is a big one ( f.e. height 50px ) – just add more padding on top:

    #footer {
      background-size: 100% 50px;
      background-position: 0px 0px;
      background-repeat: no-repeat;
      background-image: linear-gradient(180deg, green 0%, green 25%, blue 25%, blue 50%, purple 50%, purple 75%, orange 75%, orange 100%);
      padding: 65px 0 30px 0;
    }

    Big advantage of that way: if you have a curtain effect on footer – this will be o.k. because no extra calculation is needed – these lines are part of the footer height.

    ____________________
    PS:
    But if you like to make it your way:
    Enfold got a hook for that: ava_before_footer

    add_action('ava_before_footer', function() {
    echo '<div id="de-footer-bar">
            <div class="de-colour green"></div>
            <div class="de-colour blue"></div>
            <div class="de-colour purple"></div>
            <div class="de-colour orange"></div>
        </div>';
    });
    #1402846

    Hi,

    You can try @Guenni007’s recommendation above and use css to create the colored bar, but if you want to continue with the previous solution, try to replace get_footer hook with the ava_before_footer hook as suggested above. This is one of the template hooks in the footer.php file.

    Best regards,
    Ismael

    #1402886

    “why don’t you solve it by just css”

    Cos I’m not cleverer enough!

    I’ve tried this and it works. Thank you. And it meant that I annoyed my wife as I lay in bed last night reading up on the CSS Gradient docs.

    I also tried the ava_before_footer hook but this still only worked on the pages without a colour section as the last element.

    Thank you.

    #1402896

    Not for this – I didn’t know you could set gradients on sharp transitions for a long time.
    you are welcome! I am always happy to help

    #1403014

    Hi,

    Thanks for helping out @guenni007 :-)

    Best regards,
    Rikard

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