PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, January 11, 2022

[FIXED] How to insert a script into a given file using echo?

 January 11, 2022     php, wordpress     No comments   

Issue

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>
' );

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.



Answered By - Akhtarujjaman Shuvo
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing