<!-- 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 主题的文章款式都是不一样的,然而在应用后盾的可视化编辑器编辑...
首先,你需求理解query_posts函数。该函数的作用就是对文章进行检索、筛选、排序,在其后的LOOP循环中应用通...
WordPress 现有的备份办法和存在的成绩 关于 WordPress 博客来说,有很多备份的办法,数据库能够间接经过 P...
通过两天的正则表白式的学习,和钻研wordpress的路由函数,胜利完成了自定义wordpress路由性能,以下是路由...
要想完成自定义菜单,需求用到的函数是wp_nav_menu(),给这个函数传递一些参数就能够输入自定义菜单菜单,上...
get_template_part() 用来援用模板文件,相似于 get_header()、get_sidebar() 和 get_footer(),只不过这个...