中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

WordPress常用調(diào)用標(biāo)簽匯總

2018-11-01    來源:學(xué)做網(wǎng)站論壇

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用

我們使用Wordpress程序搭建一個網(wǎng)站,網(wǎng)站的內(nèi)容是不斷更新的,這就需要用代碼來把這個更新的內(nèi)容調(diào)用出來。下面是WordPress常用調(diào)用標(biāo)簽匯總。(相關(guān)教程:wordpress建站教程)

1、最新文章

對應(yīng)函數(shù):<?php get_recent_posts(); ?>

詳細(xì)說明:

get_recent_posts($no_posts = 5, $before = ‘<li>+ ‘, $after = ‘</li>’, $show_pass_post = false, $skip_posts = 0)

$no_posts:顯示文章數(shù),缺省為5條;

$before:每條記錄前顯示的文字,缺省<li>

$after:每條記錄后顯示的文字,缺省</li>

$show_pass_post:是(true)/(false)顯示保護(hù)了的文章,缺省否(false)

$skip_posts:跳過多少篇文章,缺省為0

2、最新留言

對應(yīng)函數(shù):<?php get_recent_comments(); ?>

詳細(xì)說明:

get_recent_comments($no_comments = 5, $before = ‘<li> ‘, $after = ‘</li>’, $show_pass_post = false)

$no_comments:顯示回響數(shù),缺省為5條;

$before:每條記錄前顯示的文字,缺省<li>

$after:每條記錄后顯示的文字,缺省</li>

$show_pass_post:是(true)/(false)顯示保護(hù)了的文章,缺省否(false)

如果希望在最新留言里不顯示自己的回復(fù)。在get_recentcomments() 這個函數(shù)里找到這一句

post_status = ‘publish’

在后面 加上

AND comment_author != ‘管理員的昵稱’

就可以了。(注意:引號是半角的)

拓展函數(shù):

僅顯示留言,不包括引用的函數(shù)<?php get_recent_comments_only (); ?>

僅顯示引用(但包括trackbackpingback<?php get_recent_trackbacks(); ?>

3、評論最多的文章

對應(yīng)函數(shù):<?php get_mostcommented(); ?>

詳細(xì)說明:

// Get Top Commented Posts

get_mostcommented($limit = 5)

提示可以使用這個函數(shù)來實(shí)現(xiàn)熱門文章的功能,即評論最多的文章。

4、發(fā)表評論最多的朋友

對應(yīng)函數(shù):<?php get_commentmembersstats(); ?>

詳細(xì)說明:

get_commentmembersstats($threshhold = 5)

把代碼里面的blogmaster改成你自己的名字,可以濾掉你自己的名字。下面加粗的那一項(xiàng)。

// Get Comments’ Members Stats

// Treshhold = Number Of Posts User Must Have Before It Will Display His Name Out

// 5 = Default Treshhold; -1 = Disable Treshhold

function get_commentmembersstats($threshhold = 5) {

global $wpdb, $tablecomments;

$comments = $wpdb->get_results(SELECT comment_author, comment_author_url, COUNT(comment_ID) AS comment_totalFROM $tablecomments WHERE comment_approved = 1AND (comment_author != ‘網(wǎng)頁教學(xué)網(wǎng)’) AND (comment_author != )GROUP BY comment_author ORDER BY comment_total DESC”);

$no = 1;

5、隨機(jī)文章

對應(yīng)函數(shù): <?php random_posts(); ?>

詳細(xì)說明:

random_posts ($limit = 5, $length = 400, $before = ‘<li>’, $after = ‘</li>’, $show_pass_post = false, $show_excerpt_in_title = true)

$limit:顯示文章數(shù),缺省5篇;

$length:摘要長度,缺省400;

$before:每條記錄前顯示的文字,缺省<li>

$after:每條記錄后顯示的文字,缺省</li>

$show_pass_post:是(true)/(false)顯示保護(hù)了的文章,缺省否(false)

$show_excerpt_in_title:是(true),摘要顯示于文章鏈接的title;否(false),直接顯示于頁面;缺省是(true)

標(biāo)簽: isp 代碼 建站 建站教程

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:MYSQL數(shù)據(jù)庫的數(shù)據(jù)表中字段類型的含義解釋

下一篇:wordpress首頁如何調(diào)用最新文章