<!-- 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 文章循环中( Lo...
WordPress呈现“需求晋级数据库”普通是网站搬家,或许WordPress版本晋级会呈现。普通状况呈现的...
有意中发现一款性能弱小的Wordpress代码高亮插件 – Crayon Syntaxer,我以为能够算是目前款式最多、易...
间接上代码吧 复制代码代码如下:<title><?phpif(is_category()){ single_cat_title();}elseif(is_single() ...
本文实例讲述了Wordpress完成文章支持和拥护性能的办法。分享给大家供大家参考。详细剖析如下: 假如你上网...
1.增加性能 在function.php中拔出代码 add_theme_support('post-thumbnails'); 拔出之后会在后盾编辑文章的...