-
AuthorPosts
-
March 28, 2023 at 4:54 pm #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.
March 28, 2023 at 10:11 pm #1402826why 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_footeradd_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>'; });
March 29, 2023 at 3:29 am #1402846Hi,
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,
IsmaelMarch 29, 2023 at 12:07 pm #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.
March 29, 2023 at 12:35 pm #1402896Not 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 helpMarch 30, 2023 at 2:08 pm #1403014 -
AuthorPosts
- You must be logged in to reply to this topic.