Home > Blockchain >  How to insert a script into a given file using echo?
How to insert a script into a given file using echo?

Time:01-06

on my 'wordpress' site in the 'footer.php' file is the following script.

<?php
/**
 * The template for displaying the footer
 *
 * Contains the closing of the "site-content" div and all content after.
 *
 * @package WordPress
 * @subpackage Puca
 * @since Puca 1.3.6
 */

$active_theme = puca_tbay_get_theme();

get_template_part( 'footer/themes/'.$active_theme.'/footer' );

I need to insert a script before the </body> in the file in this directory.

'footer/themes/'.$active_theme.'/footer/'

How can I do this using echo? exemple

echo( 'footer/themes/'.$active_theme.'/footer', '<script src="//code.tidio.co/n.js" async></script>
' );

CodePudding user response:

Your question needs more information.

As per your question maybe here's what you're looking for?

<?php
/**
 * The template for displaying the footer
 *
 * Contains the closing of the "site-content" div and all content after.
 *
 * @package WordPress
 * @subpackage Puca
 * @since Puca 1.3.6
 */

$active_theme = puca_tbay_get_theme();

echo '<script src="//code.tidio.co/n.js" async></script>';

get_template_part( 'footer/themes/'.$active_theme.'/footer' );

Not tested.

  •  Tags:  
  • Related