Black Friday Sale!

Save up to $50 through December 3rd.

Shop Now

[Resolved] WP Hooks at Page Level

Home Forums Support [Resolved] WP Hooks at Page Level

Home Forums Support WP Hooks at Page Level

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #388516
    Vinai

    Is it possible to have wp_hooks at a page level, so that we can insert the Google conversion code at the bottom of the page, just above the closing </body> tag?

    I tried a couple of header/footer script inserting plug-ins, but they don’t insert the script exactly above the </body>, but somewhere higher up…

    Is there a neat solution to do this. Thanks.

    #388819
    Leo
    Staff
    Customer Support

    Hi there,

    Looks like you are looking for the wp_footer hook? https://docs.generatepress.com/article/wp_footer/?

    Let me know.

    #389145
    Vinai

    yes, but I want the footer hook at each page level, not for the entire site.

    Keep in mind, I am NOT installing Google Analytics code – which goes on EACH page.

    I am installing Google CONVERSION code, which is a specific piece of code for specific pages. NOT ALL PAGES.

    Can wp_footer do this? If not, what is the alternative? Thanks.

    #389151
    Leo
    Staff
    Customer Support

    You’d have to use conditional tags in hooks. Something like this:

    <?php if ( is_page( array( '1268', '6' ) ) ) :
        code here
    endif; ?>

    See how to use conditional tags here: https://codex.wordpress.org/Conditional_Tags#A_PAGE_Page

    #389154
    Vinai

    ok got it. Thanks Leo.

    #389448
    Leo
    Staff
    Customer Support

    No problem!

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