Archived topic
Add Attribute To Site Footer
5 replies · Started by Jackie on April 28, 2020
Hi,
Just wondering how I would go about adding a custom attribute to the HTML of the site footer.
I am look to change this:
<div class="site-footer">
to this:
<div class="site-footer" data-aos="fade-up">
Many thanks.
Hi there,
As of right now, it's not possible without overwriting the entire footer.php file.
I wonder if there's an alternative to a data attribute there? It is possible to add a custom class.
Hi Tom,
Thanks for your response.
I could do this but it would mean tweaking the CSS provided from Animate on Scroll which is something I would need to set aside a bit more time to accomplish.
Another thought, is there anyway of wrapping the site footer into a containing <div>? Adding the attribute to a parent <div> would also solve the problem.
Hi there,
you can add a wrapper around the footer with this PHP snippet:
add_action( 'generate_before_footer', function(){
echo '<div class="footer-wrapper" data-aos="fade-up">';
},1);
add_action( 'generate_after_footer', function(){
echo '</div>';
},15);
Hi David,
That snippet worked a treat. Thanks for your help :)
You're welcome