[Resolved] Inserting text after footer content using hook

Home Forums Support [Resolved] Inserting text after footer content using hook

Home Forums Support Inserting text after footer content using hook

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1568670
    Baz

    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.

    #1568766
    Leo
    Staff
    Customer Support

    Hi there,

    Can you try inserting the text using the footer bar widget area first?
    https://docs.generatepress.com/article/footer-bar-widget-area/

    Then set the alignment to center:
    https://docs.generatepress.com/article/footer-bar-widget-area/#footer-bar-alignment

    Then we can just tweak the layout with a bit of CSS if needed.

    Let me know πŸ™‚

    #1568781
    Baz

    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.

    #1568782
    Leo
    Staff
    Customer Support

    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?

    #1568793
    Baz

    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!!! πŸ™‚

    #1568796
    Leo
    Staff
    Customer Support

    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.

    #1568797
    Baz

    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.

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