<!-- 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 输出页面代码的方法》的一些看法。更多内容请查看本栏目更多内容!
咱们都晓得WordPress顺序很弱小,对搜寻引擎优化很敌对,然而有一点可能有些人还不是很分明,关于WordPress这样...
p.s.在搜寻引擎优化SEO上,百度仿佛对要害词TAGS更为偏爱 其实就是撰写一个新页面,它要使用一个名为tags.php...
民间引见: 1,经过插件能够创立adsense广告位。 2,能够间接经过工具在网管中心验证网站。 之前站长David...
一、增加一个存储投稿者邮箱的自定义栏目 关上WordPress增加投稿性能,上面咱们将对这篇文章中的代码进...
此时假如上传一个不在预约义的平安扩大名列表,如.lrc,会报错: File type does not meet security guidel...
wordpress博客是应用人数最多的一个开源博客顺序,动态化也是最多人像要到的成绩,关于老手来收,动态化的解...