Site logo

Archived topic

Inserting text after footer content using hook

6 replies · Started by Baz on December 5, 2020

Viewing posts 1–7 of 7

Hi, I just need to insert some text after the site footer.

I know I can target the area using generate_after_footer in Elements, but I won't be using any other filters/hooks in Elements, so not sure if it's worth enabling the module for just one filter.

Can you please provide the PHP code/syntax I need to add to functions.php

Out of curiosity, would you rather enable the Elements module for only 1 or 2 hooks, or use functions.php? I'm just wary of enabling too many modules if it's going to increase server calls/resources.

Thank you.

Hi Leo, I can do what you suggested using the footer bar, but I wanted to create a separate container area so I can target with specific CSS (alignment, background etc).

I was able to do this using Elements module, but just wondered if there was a code snippet I could use instead.

I don't need to add any other code in Elements, so not sure it was worth activating.

Thanks.

I can do what you suggested using the footer bar, but I wanted to create a separate container area so I can target with specific CSS (alignment, background etc).

We should be able to do that with the footer bar area.

Any chance you can link me to the page in question?

Sorry Leo, it's on local development.

I was was hoping that there was a snippet I could use to target that area, and insert the text e.g.

add_action( 'generate_after_footer','example_function_name' );  
function example_function_name() { ?> 
    <div class="after-footer-area">
    Insert my text here...
</div>
<?php }

Apologies if the above is incorrect, I'm still trying to understand PHP.

Thanks.

Hey, I just checked and that actually worked!!! :)

Yup that looks good.

But there is really no advantage to do that over the footer bar widget area from what I can tell.

It basically introduces extra functions.

I must have made a typo somewhere.

I hope that's the correct way to target the after footer area :)

I will try your other suggestion too.

Thanks Leo.

This archived topic is closed to new replies.