拨开荷叶行,寻梦已然成。仙女莲花里,翩翩白鹭情。
IMG-LOGO
主页 文章列表 如何使用echo将脚本插入给定档案?

如何使用echo将脚本插入给定档案?

白鹭 - 2022-03-24 1960 0 0

在“footer.php”档案中的“wordpress”网站上是以下脚本。

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

我需要</body> 在这个目录的档案之前插入一个脚本

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

如何使用回声来做到这一点?例子

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

uj5u.com热心网友回复:

您的问题需要更多信息。

根据您的问题,也许这就是您要找的东西?

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

未测验。

标签:

0 评论

发表评论

您的电子邮件地址不会被公开。 必填的字段已做标记 *