欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

WordPress

當前位置:主頁 > CMS教程 > WordPress >

wordpress get

來源:本站原創(chuàng)|時間:2020-01-11|欄目:WordPress|點擊: 次

使用wordpress禁止輸出指定類別的文章可以給get_posts()函數(shù)傳個數(shù)組參數(shù),如下:

復制代碼
代碼如下:

<div class="widget" id="diary1">
<h3>隨機呈現(xiàn)</h3>
<ul>
<?php
$args=array(
'numberposts'=>16,
'category'=>'-9,-12',
'orderby'=>'rand'
);
$rand_posts = get_posts($args);
foreach( $rand_posts as $post ) :
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
</div>

其中:

復制代碼
代碼如下:

$args=array(
'numberposts'=>16,
'category'=>'-9,-12',
'orderby'=>'rand'
);

鍵名numberposts表示取出的文章數(shù),category表示要顯示的文章的類別ID,負數(shù)代表不顯示,以字符串的形式用逗號隔開,orderby這里表示隨機取出文章。
效果如小談博客首頁右側(cè)“隨機呈現(xiàn)”效果,去掉了php類別的文章顯示,因為下面有了一個“php專欄”,避免重復。
get_posts()函數(shù)完整的參數(shù)列表:

復制代碼
代碼如下:

<?php $args = array(
'posts_per_page' => 5,
'numberposts' => 5,
'offset' => 0,
'category' => '',
'orderby' => 'post_date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'post_status' => 'publish',
'suppress_filters' => true );
?>

上一篇:wordpress獲取文章評論數(shù)過濾掉作者代碼分享

欄    目:WordPress

下一篇:自己做wordpress評論插件修改評論樣式(兩步美化評論內(nèi)容)

本文標題:wordpress get

本文地址:http://mengdiqiu.com.cn/a1/WordPress/12821.html

網(wǎng)頁制作CMS教程網(wǎng)絡編程軟件編程腳本語言數(shù)據(jù)庫服務器

如果侵犯了您的權利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導致的法律后果,本站均不負任何責任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權所有