使用wordpress建网站时,在侧边栏往往需要调用某个指定分类下的子分类,这样只要在网站后台添加分类后,网站界面就会自动的调用显示出来。(要想在不同的分类调用各自的子分类,请学习wordpress不同分类调用当前子分类教程。)
以...
[php]
<?php if (have_posts()) : ?>
<?php query_posts('cat=ID号' . $mcatID. '&caller_get_posts=1&showposts=显示数量'); ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?...
[php]
<?php
$loop_cate_id=array(1,2,3);
$num=5;
?>
<?php foreach($loop_cate_id as $key=>$value){ ?>
<div class="bankuai">
<?php $posts = query_posts($query_string . "&...
List of WordPress Functions
1. get_theme_mod()
Syntax
Usage
2. apply_filters()
Syntax
Usage
3. add_filter()
Syntax
Usage
4. get_option()
Syntax
Usage
...
WordPress is a powerful publishing platform which allows both users with no coding experience and developers alike to create and share content quickly and easily. What if you want to start developing themes and ...
在制作wordpress模板的时候会要调用网站的文章总数分类总数tag总数等这个数值,如果直接用count查询数据库那就太过分了。好在wordpress内置了一些标签可以直接获取到这些数值,本文整理了一些常用的wordpress网站总数标签。
文章总...
整站随机文章
[php]
//numberposts 为文章数量
<?php
$args = array( 'numberposts' => 5, 'orderby' => 'rand', 'post_status' => 'publish' );
$rand_posts = get_posts( $args );
foreach( $rand_posts ...
[php]
<ul class="rowNewsUl">
<?php
$args = array(
'post_type' => 'post',
'showposts' => 3,
...
一、通过WP_Comment_Query()方法获取
[php]
function bg_recent_comments($no_comments = 5, $comment_len = 80, $avatar_size = 48) {
$comments_query = new WP_Comment_Query();
$comments = $comments_query->qu...
我们要在CMS样式的博客首页调取最新评论文章,比如你可以根据评论的多少排序实现最热文章的效果,代码如下:
[php]
<?php
$post_num = 10; // 设置调用条数
$args = array(
'post_password' =>'',
...