<!-- 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 输出页面代码的方法》的一些看法。更多内容请查看本栏目更多内容!
目前本站曾经有300多篇日志和超越2000条评论,尽管数据量不是很多然而偶然会呈现,404或许是500亦或是502谬...
要害字形容:性能 标签 选项 设置 能够 文章 默许 Blog 这个 用户 上次课程咱们解说 Wordpress 用户的治理...
你还没决议应用什么软件来构建你的新公司网站吗? 依然以为WordPress只是搭建博客吗? 在互联网上有大约2...
这里选取的例子,便是 WordPress 中比拟有名的丑化超链接Title成果,普通的 title 成果是把鼠标放到 a 元素...
同get_post_meta()一样,用于前往文章的自定义字段值得一个函数,只不过get_post_custom()函数应用起来更简...
函数esc_js()(过滤 Html 内嵌 JS) 参数 $text (字符串)(必需)要过滤的字符串。 默许值:None 前往值 ...