New Landing How can we help? Themeforest Theme Support Uplift Code to child theme

Viewing 2 posts - 1 through 2 (of 2 total)
  • Posted in: Uplift
  • #303672
    micheal_w
    Member
    Post count: 498

    Hi guys,

    I would like to add a code to my site, it needs to be added between tags <head> and </head>
    How can I add this to my child theme? I have functions.php and style.css only…

    Thanks!

    <script type="text/javascript">
    .
    .
    .
    </script>
    #303681
    David Martin – Support
    Moderator
    Post count: 20834

    You would create a PHP function to output the code to a WordPress action within the header file. So in your child theme functions.php:

    if ( ! function_exists( 'sf_uplift_add_header_code' ) ) {
          function sf_uplift_add_header_code() { ?>
          
    	      <script type="text/javascript">
    	      </script>
          
          <?php }
          add_action('wp_head', 'sf_uplift_add_header_code');
    }
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.