久久精品水蜜桃av综合天堂,久久精品丝袜高跟鞋,精品国产肉丝袜久久,国产一区二区三区色噜噜,黑人video粗暴亚裔
站長百科 | 數(shù)字化技能提升教程 數(shù)字化時(shí)代生存寶典
首頁
數(shù)字化百科
電子書
建站程序
開發(fā)
服務(wù)器
辦公軟件
開發(fā)教程
服務(wù)器教程
軟件使用教程
運(yùn)營教程
熱門電子書
WordPress教程
寶塔面板教程
CSS教程
Shopify教程
導(dǎo)航
程序頻道
推廣頻道
網(wǎng)賺頻道
人物頻道
網(wǎng)站程序
網(wǎng)頁制作
云計(jì)算
服務(wù)器
CMS
論壇
網(wǎng)店
虛擬主機(jī)
cPanel
網(wǎng)址導(dǎo)航
WIKI使用導(dǎo)航
WIKI首頁
最新資訊
網(wǎng)站程序
站長人物
頁面分類
使用幫助
編輯測(cè)試
創(chuàng)建條目
網(wǎng)站地圖
站長百科導(dǎo)航
站長百科
主機(jī)偵探
IDCtalk云說
跨境電商導(dǎo)航
WordPress啦
站長專題
網(wǎng)站推廣
網(wǎng)站程序
網(wǎng)站賺錢
虛擬主機(jī)
cPanel
網(wǎng)址導(dǎo)航專題
云計(jì)算
微博營銷
虛擬主機(jī)管理系統(tǒng)
開放平臺(tái)
WIKI程序與應(yīng)用
美國十大主機(jī)
編輯“
WordPress:The Loop in Action
”(章節(jié))
人物百科
|
營銷百科
|
網(wǎng)賺百科
|
站長工具
|
網(wǎng)站程序
|
域名主機(jī)
|
互聯(lián)網(wǎng)公司
|
分類索引
跳轉(zhuǎn)至:
導(dǎo)航
、?
搜索
警告:
您沒有登錄。如果您做出任意編輯,您的IP地址將會(huì)公開可見。如果您
登錄
或
創(chuàng)建
一個(gè)賬戶,您的編輯將歸屬于您的用戶名,且將享受其他好處。
反垃圾檢查。
不要
加入這個(gè)!
==其它模板中的Loop== WordPress可以使用不同的模板文件,用不同的方式顯示你的blog。在默認(rèn)WordPress主題中,有用于索引瀏覽的[[WordPress:Templates|模板文件]],分類瀏覽和文檔瀏覽,就象一個(gè)瀏覽單獨(dú)文章的模板。這些都會(huì)用到[[WordPress:The Loop|Loop]],但是這些都沒有太大的差距,就象[[WordPress:Template_Tags|模板標(biāo)簽]]之間的不同用法似的。 至于那些沒有分開的模板文件的情況,WordPress使用默認(rèn)時(shí)的<tt>index.php</tt>。如果訪問者請(qǐng)求閱讀一個(gè)單獨(dú)的文章時(shí),WordPress會(huì)首先查找一個(gè)名字為<tt>single.php</tt>的文件。如果這個(gè)文件存在,它就會(huì)用來顯示這個(gè)文章。如果不存在,WordPress就會(huì)使用<tt>index.php</tt>來顯示文章。這叫做[[WordPress:Template Hierarchy|模板層次]]. 如果你正在制作你自己的[[WordPress:Using Themes|主題]],在默認(rèn)主題中查看[[WordPress:Templates|模板文件]],作為參考,很有用。同樣,使用你的主題的<tt>index.php</tt>作為你的其他模板文件的模板也是很有用的。因?yàn)槟銊?chuàng)建了更多的模板文件,這樣做可能會(huì)帶給你一個(gè)已知的工作頁面,從這里開始作出更改。 ===不同的歸檔格式=== <em>archive</em>是歷史文章的集合。在默認(rèn)時(shí),文章在主索引中顯示的是最新的[http://mydatapages.com/chronological.html 按時(shí)間順序的]記錄。當(dāng)訪問者點(diǎn)擊某個(gè)文檔連接時(shí),或者他們手動(dòng)請(qǐng)求某個(gè)特定時(shí)間時(shí),(使用<nowiki>http://www.example.com/blog/index.php?m=200504</nowiki>或者 <nowiki>http://www.example.com/blog/2005/04</nowiki> 來選擇所有2005年4月后的文章),WordPress將顯示<em>archive</em>內(nèi)容。默認(rèn)情況下,歸檔將使用<tt>index.php</tt>,然后和你的首頁一樣,只顯示出2005年四月后的文章。 當(dāng)WordPress為訪問者準(zhǔn)備[[WordPress:Creating_an_Archive_Index|歸檔界面]]時(shí),它會(huì)在你現(xiàn)用的主題目錄中明確的尋找一個(gè)叫做<tt>archive.php</tt>的文件,如果你想在首頁上使歸檔的意思明確表達(dá),那么把<tt>index.php</tt>復(fù)制到<tt>archive.php</tt>,并且按需求編輯<tt>archive.php</tt>文件。 例如,如果你只想在歸檔列表上顯示文章標(biāo)題,不包含文章內(nèi)容,你可以使用如下代碼: <pre> <?php get_header(); ?> <div id="content" class="narrowcolumn"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post"> <h2 id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"> <?php posts_nav_link('','','&laquo; Previous Entries') ?> </div> <div class="alignright"> <?php posts_nav_link('','Next Entries &raquo;','') ?> </div> </div> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center"><?php _e("Sorry, but you are looking for something that isn't here."); ?></p> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> </pre> ===不同的分類格式=== 和歸檔界面一樣,WordPress為[[WordPress:Category_Templates|分類界面]]尋找分開的模板文件。如果訪問者點(diǎn)擊了一個(gè)分類連接,他們會(huì)看到分類外觀,WordPress會(huì)只從分類中準(zhǔn)備帶有文章的Loop,限制每個(gè)blog默認(rèn)設(shè)置下的文章的數(shù)目。 要想讓你的分類界面和索引界面不同的話,復(fù)制一個(gè)<tt>index.php</tt>文件并重命名為<tt>category.php</tt>,對(duì)于分類界面,向一個(gè)分配過的文章列出分類也許不是必須的,所以我們忽略這一步。取而代之的,我們?cè)陧撁骓敳柯暶鞣诸悾? <pre> <?php get_header(); ?> <div id="content" class="narrowcolumn"> <p> <strong> <?php single_cat_title('Currently browsing '); ?> </strong><br /> <?php echo category_description(); ?> </p> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post"> <h2 id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> <?php the_title(); ?></a></h2> <small> <?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --> </small> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"> <?php posts_nav_link('','','&laquo; Previous Entries') ?> </div> <div class="alignright"> <?php posts_nav_link('','Next Entries &raquo;','') ?> </div> </div> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center"><?php _e("Sorry, but you are looking for something that isn't here."); ?></p> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> </pre> ===不同分類的不同格式=== 如在[[WordPress:Template Hierarchy|模板層次]]中敘述的,[[WordPress:Category_Templates|為每個(gè)分類創(chuàng)建分開的模板文件]]是可行的。只需要建立名字為<tt>category-<b><u>X</u></b>.php</tt>的文件,這里<b><u>X</u></b>是用數(shù)字表示的分類。仔細(xì)考慮你是否需要給某個(gè)分類建立全新的完整模板。 讓我們來看兩個(gè)分類,"Plants" 和 "Flowers",分類ID分別為3和4。在輸出的地方的每個(gè)文章標(biāo)題旁邊,你都想要有個(gè)植物或者花的圖片,取決于哪個(gè)分類被顯示,你可以這樣: * 使用兩個(gè)分開的文件, <tt>category-3.php</tt> 和 <tt>category-4.php</tt>, 每個(gè)文件給每個(gè)文章標(biāo)題使用不同的<tt>img</tt>標(biāo)簽。 * 在你的默認(rèn)<tt>category.php</tt>文件中使用條件判斷,來查看是否當(dāng)前分類是"Plants"或者 "Flowers" (或者都不是), 然后顯示合適的圖片: <pre> <?php if (is_category('3') ): // we're in the Plants category, so show a plant ?> <img src='/images/plant.png' alt='a plant' /> <?php } elseif (is_category('4') ): // we're in the Flowers category, so show a flower ?> <img src='/images/flower.png' alt='a pretty flower' /> <?php endif; // end the if, no images for other other categories ?> </pre> 如果你添加了另外一個(gè)分類,"Cars",你想讓它用一個(gè)<em>引人注目</em>的方式顯示出來,那么一個(gè)分開的<tt>category-<b><u>X</u></b>.php</tt>則是你最合適的選擇。 === 不同分類的不同CSS === 很多使用者想給特定的分類建立單獨(dú)的CSS文件。這很容易實(shí)現(xiàn)。記住樣式表是在HTML文件中的<tt><head></tt>部分定義并且加載的。WordPress使用<tt>header.php</tt>文件,在默認(rèn)<tt>header.php</tt>文件中,找到下列語句: <pre> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> </pre> And change it to something like this: <pre> <?php if ( is_category('5') ) { // Load special CSS for "Cars" category ?> <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/category-5.css" type="text/css" media="screen" />; <?php } else { ?> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <?php } ?> </pre> <strong>注意:</strong> 汽車分類模板使用<tt>category-5.css</tt>文件取代默認(rèn)版面。在這個(gè)例子中,CSS文件在應(yīng)用的分類模板文件之后被命名,而不是真正的分類名。這樣你就明白 <tt>category-5.css</tt> 是和<tt>category-5.php</tt>文件聯(lián)系在一起的了. ===不同的單一文章格式=== 當(dāng)瀏覽任意單一的文章(或者 [[WordPress:Glossary#Permalink|permalink]])的時(shí)候,如果有的話,WordPress會(huì)使用<tt>single.php</tt>。 在這個(gè)部分,在WordPress默認(rèn)的single.php文件中,提供了有關(guān)當(dāng)前文章的[[WordPress:Post_Meta_Data_Section|文章meta數(shù)據(jù)信息]]: <pre> <p class="postmetadata alt"> <small> This entry was posted on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> and is filed under <?php the_category(', ') ?>. You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed. <?php if (('open' == $post->comment_status) && ('open' == $post->ping_status)) { // Both Comments and Pings are open ?> You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(display); ?>">trackback</a> from your own site. <?php } elseif (!('open' == $post->comment_status) && ('open' == $post->ping_status)) { // Only Pings are Open ?> Responses are currently closed, but you can <a href="<?php trackback_url(display); ?> ">trackback</a> from your own site. <?php } elseif (('open' == $post->comment_status) && !('open' == $post->ping_status)) { // Comments are open, Pings are not ?> You can skip to the end and leave a response. Pinging is currently not allowed. <?php } elseif (!('open' == $post->comment_status) && !('open' == $post->ping_status)) { // Neither Comments, nor Pings are open ?> Both comments and pings are currently closed. <?php } edit_post_link('Edit this entry.','',''); ?> </small> </p> </pre> 這種信息—不論評(píng)論是公開還是關(guān)閉—是相當(dāng)不適合放在一個(gè)索引上,歸檔或者分類界面的;那也是為什么只包含在<tt>single.php</tt>模板文件中的原因。
摘要:
請(qǐng)注意,您對(duì)站長百科的所有貢獻(xiàn)都可能被其他貢獻(xiàn)者編輯,修改或刪除。如果您不希望您的文字被任意修改和再散布,請(qǐng)不要提交。
您同時(shí)也要向我們保證您所提交的內(nèi)容是您自己所作,或得自一個(gè)不受版權(quán)保護(hù)或相似自由的來源(參閱
Wordpress-mediawiki:版權(quán)
的細(xì)節(jié))。
未經(jīng)許可,請(qǐng)勿提交受版權(quán)保護(hù)的作品!
取消
編輯幫助
(在新窗口中打開)
取自“
http://kktzf.com.cn/wiki/WordPress:The_Loop_in_Action
”