<!-- recent comments -->
<?php if( function_exists('wp_recentcomments') ) : ?>
<p class="widget">
<h3>Recent Comments</h3>
<ul>
<?php wp_recentcomments('limit=10&length=17&post=false&smilies=true'); ?>
</ul>
</p>
<?php endif; ?>
<!-- recent comments -->
<?php
// 插件被激活才进行以下操作
if( function_exists('wp_recentcomments') ) {
// 逐行粘合 HTML 代码
$html = '<p class="widget">'
. '<h3>Recent Comments</h3>'
. '<ul>';
$html .= wp_recentcomments('limit=10&length=17&post=false&smilies=true', false);
$html .= '</ul>'
. '</p>';
// 本义解决
$html = str_replace('"', '\"', $html);
$html = str_replace("'", "\'", $html);
// 将 HTML 做成 JavaScript 输入代码
$out = '<script type="text/javascript">' . "\n"
. '//<![CDATA[' . "\n" // 合乎 XHTML 的正文开端
. 'document.write("' . $html . '");' . "\n"
. '//]]>' . "\n" // 合乎 XHTML 的正文完结
. '</script>';
// 输入页面代码
print($out);
}
?>
以上就是安达网络工作室关于《wordpress中用JavaScript 输出页面代码的方法》的一些看法。更多内容请查看本栏目更多内容!
Some Chinese Please插件能够阻拦不带中文字的留言,本博客不断在用成果不错,不写入数据库,可无效地缩小s...
首先列表会变得很臃肿,得到了列表的自身作用——不便用户寻觅真正想要看的帖子,其次,在搜寻引...
什么是模板呢?默许状况 WordPress是应用主标题录下page.php来作为模板显示页面的,然而有时分咱们需求不同...
这里选取的例子,便是 WordPress 中比拟有名的丑化超链接Title成果,普通的 title 成果是把鼠标放到 a 元素...
查看相干教程,UTF-8和UTF-8 + BOM有所区别,于是把function.php编码改为后者。成绩处理。 UFT-8 与UTF-8 B...
要害字形容:心得 建站 应用 菜鸟 能够 这个 边栏 主题 文章 一个 这一周都在学用wordpress来做独立博...