• Resolved Artiss

    (@artiss)


    Hi Stefano Lissa,

    I already read the [resolved] topic on this link https://ww.wp.xz.cn/support/topic/inserting-html-code-into-one-specific-page?replies=3

    However, I still do not understand how to customize the header to use js script only one specific pages I want such as Home and testimonials pages.

    I put the code below on
    Page Header and footer> Code to be added on HEAD section of the home but it does not display the pop-up
    so now I put only on Code to be added on HEAD section of every page

    However, to have the pop-up form in every page is very annoying; therefore, we would like to display the pop-up form only 3-4 pages.

    Can you please guide use how to customize the displaying only on specific pages, not all pages?

    Thank you very very much for your help in advance.

    <script type=’text/javascript’>
    (function(s) {var head = document.getElementsByTagName(‘HEAD’).item(0);var s= document.createElement(‘script’);s.type = ‘text/javascript’;s.src=’//www.formget.com/app/app_data/new-widget/popup.js’;head.appendChild(s); var options = {‘tabKey’: ‘G518-190260/t’,’tabtext’:’Free Pretest’,’height’: ‘630’,’width’: ‘350’,’tabPosition’:’right’,’textColor’: ‘ffffff’,’tabBackground’: ‘ff8c00′,’fontSize’: ’16’,’tabbed’:”};s.onload = s.onreadystatechange = function() {var rs = this.readyState;if (rs)if (rs != ‘complete’)if (rs != ‘loaded’)return;try {sideBar = new buildTabbed();sideBar.initializeOption(options);sideBar.loadContent();sideBar.buildHtml();} catch (e) {} };var scr = document.getElementsByTagName(s)[0];})(document, ‘script’);
    </script>

    https://ww.wp.xz.cn/plugins/header-footer/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Stefano Lissa

    (@satollo)

    You shouldadd a PHP condition to add the code only on specific post id. For example

    <?php if ($post->ID == 34) { ?>
    you code
    <?php } ?>

    Thread Starter Artiss

    (@artiss)

    Dear Stefano Lissa,

    Thank you so much for the explanation of adding the code again. I do not know about PHP language at all so I do not know how to deal with it. Also, I’m new to WordPress.

    The code works when I add it to “Page content” tab for one post. However, I would like to add the code for 5 posts. I tried to find other solutions already and only got the code below. Although, it’s still not working. The script do not show on the page. Do you mind to help me with this again?

    Thank you so much for your help in advance. I am very much stupid on editing it. Although, I have tried to put many ways from forums together but got some errors or not working on it.

    <?php if( !in_array($post->ID,array(88, 118)) ) { ?>
    my code
    <?php } ?>

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘js script to HEAD on specific page’ is closed to new replies.