wordpress 常用函数
来源:互联网 发布:苹果软件商店图标 编辑:程序博客网 时间:2024/06/11 04:16
wp_loginout():主题中显示“登出”链接。
clean_url():入URL并测试它的结构是否正确。如果链接前面缺少http://它可以自动添加,转换符号为正确的HTML。
wpautop() :这个函数用来转换换行符字符串为<br />标记,并把双换行符作为一个新的段落的开始,在前一段加入</p>,并在新的段落加上<p>
显示10篇最新更新文章
<?php get_archives('postbypost', 10); ?>或
<?php wp_get_archives('type=postbypost&limit=20&format=custom'); ?>
随机文章
<?php$rand_posts = get_posts('numberposts=10&orderby=rand');foreach( $rand_posts as $post ) :?><!--下面是你想自定义的Loop--><li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li><?php endforeach; ?
显示10条最新留言
<?phpglobal $wpdb;$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,comment_post_ID, comment_author, comment_date_gmt, comment_approved,comment_type,comment_author_url,SUBSTRING(comment_content,1,30) AS com_excerptFROM $wpdb->commentsLEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =$wpdb->posts.ID)WHERE comment_approved = '1' AND comment_type = '' ANDpost_password = ''ORDER BY comment_date_gmt DESCLIMIT 10";$comments = $wpdb->get_results($sql);$output = $pre_HTML;foreach ($comments as $comment) {$output .= "\n<li>".strip_tags($comment->comment_author).":" . " <a href=\"" . get_permalink($comment->ID) ."#comment-" . $comment->comment_ID . "\" title=\"on " .$comment->post_title . "\">" . strip_tags($comment->com_excerpt)."</a></li>";}$output .= $post_HTML;echo $output;?>
0 0
- WordPress常用函数!!
- wordpress 常用函数
- wordpress 常用函数参考手册
- wordpress常用函数大全
- wordpress模板常用函数
- wordpress常用函数
- wordpress 常用函数
- WordPress常用模板函数
- WordPress模板常用函数
- wordpress常用函数
- wordpress模板常用函数集锦
- WordPress模板常用函数汇总
- WordPress常用判断函数整理
- WordPress 主题制作常用函数
- WordPress主题修改常用函数
- WordPress常用模板函数 修改或自制WordPress主题必备
- WordPress模板制作教程+常用函数
- WordPress 模板制作教程+常用函数
- 1~N中随机选三个数,求其最大的 最小公倍数。
- Lucene学习总结二
- [译]Android图形系统 II 图形架构
- 如何在CentOS 7.x中安装OpenERP(Odoo)
- 利用BurpSuite爆破学校教务处弱密码学号
- wordpress 常用函数
- apache commons-codec base64将文件转为字符串
- 动态添加菜单/菜单项、子菜单、右键菜单
- 希尔排序
- JS表单提交验证
- 搭建DirectUi开发平台
- 海恩法则
- 《从零开始学Swift》学习笔记(Day 33)——属性观察者
- svn命令在linux下的使用