Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #832645

    vendinimarketing
    Participant

    Hi there,

    I need to add the following to the head section of a page on my website:

    <link href="https://www.tfaforms.com/form-builder/4.3.0/css/wforms-layout.css" rel="stylesheet" type="text/css" />
        <!--[if IE 8]>
        <link href="https://www.tfaforms.com/form-builder/4.3.0/css/wforms-layout-ie8.css" rel="stylesheet" type="text/css" />
        <![endif]-->
        <!--[if IE 7]>
        <link href="https://www.tfaforms.com/form-builder/4.3.0/css/wforms-layout-ie7.css" rel="stylesheet" type="text/css" />
        <![endif]-->
        <!--[if IE 6]>
        <link href="https://www.tfaforms.com/form-builder/4.3.0/css/wforms-layout-ie6.css" rel="stylesheet" type="text/css" />
        <![endif]-->
    
        <link href="https://www.tfaforms.com/themes/get/default" rel="stylesheet" type="text/css" />
        <link href="https://www.tfaforms.com/form-builder/4.3.0/css/wforms-jsonly.css" rel="alternate stylesheet" title="This stylesheet activated by javascript" type="text/css" />
        <script type="text/javascript" src="https://www.tfaforms.com/wForms/3.10/js/wforms.js"></script>
        <script type="text/javascript">
            wFORMS.behaviors.prefill.skip = false;
        </script>
            <script type="text/javascript" src="https://www.tfaforms.com/wForms/3.10/js/localization-en_US.js"></script>

    The page in question is here: http://www.vendini.com/gbi-form-original/

    I found a number of threads about the proper syntax used to add scripts to the head of all pages, but I’m wondering how to add it to just one page?

    Thanks,
    Joan

    #833005

    Rupok
    Member

    Hi Joan,

    Thanks for writing in!

    If you want to add this code in the <head>...</head> section of your website, add following code in your Child Theme‘s functions.php file:

    function scripts_to_head() { 
      if ( is_front_page() ) { ?>
      <!-- Add Your Scripts Here -->
    <?php } }
    
    add_action('wp_head', 'scripts_to_head');
    

    Add your code below <!– Add Your Scripts Here –>. Note: This code will work only if you are using a static homepage. If you have set your blog page as your homepage, you will need to replace is_front_page() from the code with is_home().

    If you want it for other page than home page, then you need to replace is_front_page() with is_page()

    function scripts_to_head() { 
      if ( is_page( xx ) ) { ?>
      <!-- Add Your Scripts Here -->
    <?php } }
    
    add_action('wp_head', 'scripts_to_head');

    Replace the xx with the actual page ID.

    How to Locate Post/Page IDs

    To manually enqueue a script on the <head> tag, you can copy the file _meta.php from the parent x folder \x\framework\views\global\ directory. And then paste that on \x-child\framework\views\global\ directory of your child theme.

    Hope it explain better.

    Cheers!

    #861209

    vendinimarketing
    Participant

    That worked wonderfully! Thank you 🙂

    #861836

    Prasant Rai
    Moderator

    You are most welcome. 🙂