WordPress.org

Ready to get started?Download WordPress

Forums

OpenHook
[resolved] What mistake did I make? Want to add code before closing body tag. (4 posts)

  1. mok-lim-poj
    Member
    Posted 1 year ago #

    I need to target one page only.

    The code I need to add is (I think) javascript. Since I want it before the < / body > tag, I added it to "headway_body_close".

    I added:

    if (is_page('page-1')) {
    
    <input type="hidden" id="hidLocation" value="http://domain.com/" /> <script type="text/javascript" src="http://domain.com/landing.js">
    
    }

    But that doesn't work. All pages show the code, and not just the one I want.

    What mistake did I make?

    Thanks,
    Lim

    http://wordpress.org/extend/plugins/thesis-openhook/

  2. BrazenlyGeek
    Member
    Plugin Author

    Posted 1 year ago #

    <?php if (is_page('page-1')) { ?>
    
    <input type="hidden" id="hidLocation" value="http://domain.com/" /> <script type="text/javascript" src="http://domain.com/landing.js">
    
    <?php } ?>

    You need to enclose the PHP code in PHP tags. The above should work.

  3. mok-lim-poj
    Member
    Posted 1 year ago #

    Thanks, that worked!

  4. BrazenlyGeek
    Member
    Plugin Author

    Posted 1 year ago #

    No problem, friend. Thanks for using OpenHook!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic