Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to insert a script into a given file using echo?

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading