常用的有標(biāo)題、內(nèi)容、日志元數(shù)據(jù)等。
成都創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的成華網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
循環(huán)介紹
?php if (have_posts()) : ?
?php while (have_posts()) : the_post(); ?
?php endwhile; ?
?php endif;?
· if(have_posts()) – 檢查博客是否有日志。
· while(have_posts()) – 如果有日志,那么當(dāng)博客有日志的時(shí)候,執(zhí)行下面 the_post() 這個(gè)函數(shù)。
· the_post() – 調(diào)用具體的日志來顯示。
· endwhile; – 遵照規(guī)則 #1,這里用于關(guān)閉 while()
· endif; – 關(guān)閉 if()
調(diào)用標(biāo)題
a href=";?php the_permalink() ?"?php the_title_attribute(); ?/a
標(biāo)題太長了可以用下面的:
a href=";?php the_permalink() ?" ?php echo mb_strimwidth(get_the_title(), 0, 32, '...'); ?/a
調(diào)用內(nèi)容
3-1、全文調(diào)用
?php the_content(); ?
3-2、摘要調(diào)用
?php echo mb_strimwidth(strip_tags(apply_filters('the_content', $post-post_content)), 0, 200,"……"); ?
日志元數(shù)據(jù)
4-1、發(fā)布日期
?php the_time('F d, Y') ?
?php the_time('m-d') ?
?php the_date_xml()?
4-2、所屬分類
?php the_category(', ') ?
4-3、文章標(biāo)簽
?php the_tags('標(biāo)簽: ', ', ', ''); ?
4-4、留言數(shù)
?php comments_number('暫無評論', '1條評論', '% 評論' );?
4-5、更多按鈕
a href=";?php the_permalink() ?"更多內(nèi)容/a
4-6、調(diào)用文章作者
?php the_author_posts_link();?
最新文章調(diào)用:
語法
WP標(biāo)簽:?php wp_get_archives('type=postbypostlimit=10'); ?
type=postbypost:按最新文章排列l(wèi)imit:限制文章數(shù)量最新10篇調(diào)用隨機(jī)文章:
?php
global $post;
$postid = $post-ID;
$args = array( 'orderby' = 'rand', 'post__not_in' = array($post-ID), 'showposts' = 10);
$query_posts = new WP_Query();
$query_posts-query($args);
?
?php while ($query_posts-have_posts()) : $query_posts-the_post(); ?
lia href=";?php the_permalink(); ?" rel="bookmark" title="?php the_title_attribute(); ?"?php the_title(); ?/a/li
?php endwhile; ?文章日期存檔調(diào)用
WP標(biāo)簽:?php wp_get_archives( 'type=monthly' ); ?
type=monthly按月份讀取
分類目錄調(diào)用
WP標(biāo)簽:?php wp_list_cats('sort_column=nameoptioncount=1hierarchical=0'); ?
hierarchial=0 – 不按照層式結(jié)構(gòu)顯示子分類
optioncount=1 – 顯示每個(gè)分類含有的日志數(shù)
sort_column=name – 把分類按字符順序排列
友情鏈接調(diào)用
?php wp_list_bookmarks('title_li=categorize=0orderby=randlimit=24'); ?
元數(shù)據(jù)調(diào)用
注冊:?php wp_register(); ?
登錄:?php wp_loginout(); ?
兩種方法,一種在添加文章的時(shí)候填寫相關(guān)標(biāo)簽;另一種直接在標(biāo)簽庫添加。
wordpress標(biāo)簽是把文章中某些特點(diǎn),特色拿出來標(biāo)注,就好比說張三這個(gè)人貪吃,懶惰,愛睡覺一樣的。
在實(shí)際wordpress建站時(shí),標(biāo)簽可以起到引導(dǎo)訪客訪問的作用,還有seo優(yōu)化方面也有很好的用處。