文章目录
- // 显示文章篇数和显示分类
<a href="” rel=”external nofollow” >
-
<a href="” rel=”external nofollow” rel=”external nofollow” >
- ‘publish’, // 只选公开的文章.
‘post__not_in’ => array($post->ID),//排除当前文章
‘caller_get_posts’ => 1, // 排除置顶文章.
‘orderby’ => ‘comment_count’, // 依评论数排序.
‘posts_per_page’ => $post_num
);
$query_posts = new WP_Query();
$query_posts->query($args);
while( $query_posts->have_posts() ) { $query_posts->the_post(); ?><a href="” rel=”external nofollow” rel=”external nofollow” >
文章来自小白学习资源站https://qyymz.com转载请保留本链接,谢谢!
在我们WordPress主题制作过程过用到最多的应该是调用文章的代码了,而根据主题功能需求的多样性,调用文章的需求也变得花里胡哨。
下面小白学习资源站分享了几段WordPress调用最新、热门文章的代码实例
// 显示文章篇数和显示分类
<a href="" rel="external nofollow" >
// 显示文章篇数和显示分类
<a href="" rel="external nofollow" >
<a href="" rel="external nofollow" rel="external nofollow" >
<a href="" rel="external nofollow" rel="external nofollow" >
'publish', // 只选公开的文章.
'post__not_in' => array($post->ID),//排除当前文章
'caller_get_posts' => 1, // 排除置顶文章.
'orderby' => 'comment_count', // 依评论数排序.
'posts_per_page' => $post_num
);
$query_posts = new WP_Query();
$query_posts->query($args);
while( $query_posts->have_posts() ) { $query_posts->the_post(); ?>
<a href="" rel="external nofollow" rel="external nofollow" >
'publish', // 只选公开的文章.
'post__not_in' => array($post->ID),//排除当前文章
'caller_get_posts' => 1, // 排除置顶文章.
'orderby' => 'comment_count', // 依评论数排序.
'posts_per_page' => $post_num
);
$query_posts = new WP_Query();
$query_posts->query($args);
while( $query_posts->have_posts() ) { $query_posts->the_post(); ?>
<a href="" rel="external nofollow" rel="external nofollow" >
文章来自小白学习资源站https://qyymz.com转载请保留本链接,谢谢!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
