WordPress.org

Support

Support » Themes and Templates » [Resolved] adding a HTML code before the footer

[Resolved] adding a HTML code before the footer

  • Paul
    Member

    @rhododendron

    I need to add one HTML code just before the footer and after the Latest post part.

    Please help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • d4z_c0nf
    Participant

    @d4z_c0nf

    always the same code you used with other hooks. now the hook you’re looking for is:
    __before_footer

    Paul
    Member

    @rhododendron

    I have tried that. not working

    Can you have a check?

    d4z_c0nf
    Participant

    @d4z_c0nf

    can you paste here the code you used..? (remember to use “backticks”)

    Paul
    Member

    @rhododendron

    add_filter('tc_slider_display', 'content_before_footer');
    function content_before_footer($html) {
    $after_slider = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- postbottom -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-**************1"
         data-ad-slot="6331971740"
         data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>'; //Put your HTML inside this var
    return $html.$after_slider;
    }
    d4z_c0nf
    Participant

    @d4z_c0nf

    and you put that code after slider.
    that’s the code:

    add_action('__before_footer', 'content_before_footer', 1);
    function content_before_footer() {
    ?>
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- postbottom -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-**************1"
         data-ad-slot="6331971740"
         data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    <?php
    }

    Paul
    Member

    @rhododendron

    OOpsss! sorry. Didnt notice. 🙁

    sorry for the trouble.
    And many thanks for the code! 😛

    d4z_c0nf
    Participant

    @d4z_c0nf

    Np 😀

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] adding a HTML code before the footer’ is closed to new replies.