WIKI使用導航
站長百科導航
站長專題
- 網(wǎng)站推廣
- 網(wǎng)站程序
- 網(wǎng)站賺錢
- 虛擬主機
- cPanel
- 網(wǎng)址導航專題
- 云計算
- 微博營銷
- 虛擬主機管理系統(tǒng)
- 開放平臺
- WIKI程序與應用
- 美國十大主機
WordPress: Post Meta Data Section:修訂間差異
(新頁面: __TOC__ The '''post meta data''' is the "administrative" information you provide to viewers about each post. This information usually includes the author of t...) ? |
Seadragon530(討論 | 貢獻) 無編輯摘要 |
||
第1行: | 第1行: | ||
__TOC__ | __TOC__ | ||
The '''post meta data''' is the "administrative" information you provide to viewers about | The '''post meta data''' is the "administrative" information you provide to viewers about ? | ||
In many cases, the ''post meta data'' is positioned immediately following the post itself, though some Themes are designed to place this information at the top of the post, other designs feature the ''post meta data'' in the top or bottom of the sidebar, and some designs even place the information in the footer.? Essentially, ''post meta data'' can be styled in many different ways and with a variety of details.? ? | each [[WordPress:Glossary#Post|post]].? This information usually includes the author of the | ||
? | |||
post, when it was written (or posted), and how the author | |||
? | |||
[[WordPress:Glossary#Category|categorized]] that particular post.? This lesson will show you | |||
? | |||
some different ways to change your Theme design to display these important pieces of | |||
? | |||
information in the manner you desire. | |||
? | |||
'''文章 meta數(shù)據(jù)'''是提供給訪問者的每個[[WordPress:Glossary#Post|文章]]的"管理的"信息。這個 | |||
? | |||
信息通常包括作者、寫(或是發(fā)布)的時間和作者如何[[WordPress:Glossary#Category|分類]]這篇文章。 | |||
? | |||
這一課將告訴你一些改變主題設計,使用你想要的方法來顯示這些重要信息的方法。 | |||
? | |||
In many cases, the ''post meta data'' is positioned immediately following the post itself, ? | |||
? | |||
though some Themes are designed to place this information at the top of the post, other ? | |||
? | |||
designs feature the ''post meta data'' in the top or bottom of the sidebar, and some designs ? | |||
? | |||
even place the information in the footer.? Essentially, ''post meta data'' can be styled in ? | |||
? | |||
many different ways and with a variety of details.? ? | |||
? | |||
在很多情況下,''文章 meta數(shù)據(jù)''會在文章自身形成后立即形成,一些主題設計成把這些信息放在文章 | |||
? | |||
頂部,別的一些主題可能會放在頂部或者底部的邊欄中,還有一寫主題甚至設計成放在頁腳。如果需要的 | |||
話''文章 meta數(shù)據(jù)''可以設計成不同的方式,帶有不同的多種細節(jié)內容。 | |||
==Default Usage== | ==Default Usage== | ||
The default WordPress [[WordPress:Using Themes|Theme]] places the ''post meta data'' basic information and tags below the post in a box, before the comments. A condensed version of the code looks like this: | The default WordPress [[WordPress:Using Themes|Theme]] places the ''post meta data'' basic ? | ||
? | |||
information and tags below the post in a box, before the comments. A condensed version of ? | |||
? | |||
the code looks like this: | |||
? | |||
<pre><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.</small></pre> | |||
? | |||
==默認用法== | |||
? | |||
默認的WordPress [[WordPress:Using Themes|主題]]把''文章 meta數(shù)據(jù)''這基本信息和標簽定位在文章 | |||
下部分,在評論之前的一個信息框中。簡化的代碼如下: | |||
<pre><small>This entry was posted on ? | <pre><small>This entry was posted on ? | ||
第18行: | 第64行: | ||
The output result looks like this: | The output result looks like this: | ||
<div style="border:1px solid #afafca; background: #F2F2F2; margin: 10px; padding:20px">This entry was posted on Monday, February 12, 2003 at 11:32 and is filed under [[WordPress:#Default Usage|WordPress Lessons]], [[WordPress:#Default Usage|Things to Know]]. You can follow any responses to this entry though the [[WordPress:#Default Usage|RSS 2.0]] feed.</div> | <div style="border:1px solid #afafca; background: #F2F2F2; margin: 10px; padding:20px">This ? | ||
? | |||
entry was posted on Monday, February 12, 2003 at 11:32 and is filed under ? | |||
? | |||
[[WordPress:#Default Usage|WordPress Lessons]], [[WordPress:#Default Usage|Things to Know]]. ? | |||
? | |||
You can follow any responses to this entry though the [[WordPress:#Default Usage|RSS 2.0]] ? | |||
? | |||
feed.</div> | |||
? | |||
這輸出結果如下: | |||
? | |||
<div style="border:1px solid #afafca; background: #F2F2F2; margin: 10px; padding:20px">This | |||
? | |||
entry was posted on Monday, February 12, 2003 at 11:32 and is filed under | |||
? | |||
[[WordPress:#Default Usage|WordPress Lessons]], [[WordPress:#Default Usage|Things to Know]]. | |||
? | |||
You can follow any responses to this entry though the [[WordPress:#Default Usage|RSS 2.0]] | |||
? | |||
feed.</div> | |||
? | |||
There are three [[WordPress:Template Tags|template tags]] used in the ''post meta data''.? | |||
? | |||
One, <tt>[[WordPress:Template Tags/the_time|the_time()]]</tt>, is used twice with different | |||
? | |||
results.? The other two tags get the information about the categories and the link to the | |||
? | |||
RSS feed from the database. | |||
? | |||
在''文章 meta數(shù)據(jù)''中有3種[[WordPress:Template Tags|模板標簽]]可以使用,第一,<tt> | |||
? | |||
[[WordPress:Template Tags/the_time|the_time()]]</tt>,使用兩次帶有不同的結果,另外兩種標簽是 | |||
? | |||
得到關于分類的信息和從數(shù)據(jù)庫到RSS feed的連接。 | |||
? | |||
The template tag for <tt>the_time()</tt> can be set up with a variety of parameters to tell | |||
? | |||
the time and date of the post from information drawn from the database.? In the first usage, | |||
? | |||
the parameters <tt>l, F jS, Y</tt> pull the post's date into a format that gives the | |||
? | |||
''weekday, month, date,'' and ''year''.? In the second usage, there are no parameters, | |||
? | |||
therefore it just returns the time when the post was saved.? You will experiment with these | |||
? | |||
below in [[WordPress:#Changing the Time and Date|Changing the Time and Date]]. | |||
? | |||
<tt>the_time()</tt>的模板標簽有很多顯示數(shù)據(jù)庫中的文章時間和日期的參數(shù)可以設置。第一種用法, | |||
? | |||
<tt>l, F jS, Y</tt>參數(shù),把文章的日期設置成一個''周日, 月, 日,'' and ''年''的格式,第二種用 | |||
? | |||
法,沒有任何參數(shù),這樣它只是返回文章是什么時候保存的值。你在下面的[[WordPress:#Changing the | |||
? | |||
Time and Date|更改時間和日期]]中就會體會到。 | |||
? | |||
The template tag <tt>[[WordPress:Template Tags/the_category|the_category()]]</tt> displays | |||
? | |||
the [[WordPress:Glossary#Category|categories]] that the post belongs to.? This template tag | |||
? | |||
can be modified to feature different text, graphics and symbols between the graphics, and | |||
? | |||
may even use a plugin to display graphics in place of the words.? There are many ways to | |||
? | |||
style these. In this example, the [[WordPress:Glossary#Category|categories]] are listed with | |||
? | |||
a [[WordPress:Separating_Categories|comma to separate them]]. | |||
? | |||
模板標簽<tt>[[WordPress:Template Tags/the_category|the_category()]]</tt>顯示文章所屬的 | |||
? | |||
[[WordPress:Glossary#Category|分類]]。這個模板標簽可以更改來適應不同的文本、圖片、圖片之間的 | |||
? | |||
符號,還可以使用插件來代替文字顯示圖片。有很多種設計方法。在這個例子中列出的 | |||
? | |||
[[WordPress:Glossary#Category|分類]][[WordPress:Separating_Categories|使用逗號分開它們]]。 | |||
? | |||
The last tag is the <tt>[[WordPress:Template Tags/comments_rss_link|comments_rss_link()]] | |||
? | |||
</tt> which uses the parameter <tt>RSS 2.0</tt> to identify the type of | |||
? | |||
[[WordPress:WordPress Feeds|feed]] being used. You can also [[WordPress:Customizing | |||
Feeds|customize the feed tag]], changing the way it displays the link information about the ? | |||
feed and type, or even have it feature feed icons instead of text. | |||
最后一個標簽是<tt>[[WordPress:Template Tags/comments_rss_link|comments_rss_link()]]</tt>,使 | |||
用參數(shù)<tt>RSS 2.0</tt>來識別使用的[[WordPress:WordPress Feeds|feed]]類型。你也可以 | |||
? | |||
[[WordPress:Customizing Feeds|自定義feed標簽]],更改它的顯示有關feed和模型的連接信息的方式, | |||
? | |||
或者使用feed圖標來代替文本。 | |||
==Changing the Text== | ==Changing the Text== | ||
Let's start to rearrange your ''post meta data'' with small steps.? The first step is to change the text but not the tags.? After all, this is your website and you want it to say things ''your way'', right?? This example makes the ''post meta data'' a little more conversational: | Let's start to rearrange your ''post meta data'' with small steps.? The first step is to ? | ||
? | |||
change the text but not the tags.? After all, this is your website and you want it to say ? | |||
? | |||
things ''your way'', right?? This example makes the ''post meta data'' a little more ? | |||
? | |||
conversational: | |||
? | |||
<pre><small>I slaved away at the computer on <?php the_time('l, F jS, Y') ?> | |||
at the ridiculous time of <?php the_time() ?> when I could have | |||
been doing something much more productive.? I slapped this | |||
thing into the <?php the_category(' and ') ?> categories, just | |||
to make you think I have some organizational skills.? If you | |||
can really be bothered, you can keep track of what people | |||
have to say about my silly writings through the | |||
<?php comments_rss_link('RSS 2.0'); ?> feed, but I | |||
wouldn't bother.? No one else who reads this babble has | |||
anything worthwhile to say.</small></pre> | |||
? | |||
==更改文本== | |||
? | |||
讓我們開始重新排版你的''文章 meta數(shù)據(jù)''。第一步是更改文本而不是標簽。畢竟,這是你的網(wǎng)站,你 | |||
? | |||
希望它使用你的方式來排列,對吧?這個例子讓''文章 meta數(shù)據(jù)''更加會話式: | |||
<pre><small>I slaved away at the computer on <?php the_time('l, F jS, Y') ?> ? | <pre><small>I slaved away at the computer on <?php the_time('l, F jS, Y') ?> ? | ||
第45行: | 第198行: | ||
This would result in: | This would result in: | ||
<div style="border:1px solid #afafca; margin: 10px; padding:20px">I slaved away at the computer on Monday, February 12, 2003 at the ridiculous time of 11:32. when I could have been doing something much more productive.? I slapped this thing into the [[WordPress:#Changing the Text|WordPress Lessons]] and [[WordPress:#Changing the Text|Things to Know]]. categories, just to make you think I have some organizational skills.? If you can really be bothered, you can keep track of what people have to say about my silly writings through the [[WordPress:#Changing the Text|RSS 2.0]] feed, but I wouldn't bother.? No one else who reads this babble has anything worthwhile to say.</div> | <div style="border:1px solid #afafca; margin: 10px; padding:20px">I slaved away at the ? | ||
? | |||
computer on Monday, February 12, 2003 at the ridiculous time of 11:32. when I could have ? | |||
? | |||
been doing something much more productive.? I slapped this thing into the ? | |||
? | |||
[[WordPress:#Changing the Text|WordPress Lessons]] and [[WordPress:#Changing the Text|Things ? | |||
? | |||
to Know]]. categories, just to make you think I have some organizational skills.? If you can ? | |||
? | |||
really be bothered, you can keep track of what people have to say about my silly writings ? | |||
? | |||
through the [[WordPress:#Changing the Text|RSS 2.0]] feed, but I wouldn't bother.? No one ? | |||
? | |||
else who reads this babble has anything worthwhile to say.</div> | |||
? | |||
顯示結果如下: | |||
? | |||
<div style="border:1px solid #afafca; margin: 10px; padding:20px">I slaved away at the | |||
? | |||
computer on Monday, February 12, 2003 at the ridiculous time of 11:32. when I could have | |||
? | |||
been doing something much more productive.? I slapped this thing into the | |||
? | |||
[[WordPress:#Changing the Text|WordPress Lessons]] and [[WordPress:#Changing the Text|Things | |||
? | |||
to Know]]. categories, just to make you think I have some organizational skills.? If you can | |||
? | |||
really be bothered, you can keep track of what people have to say about my silly writings | |||
? | |||
through the [[WordPress:#Changing the Text|RSS 2.0]] feed, but I wouldn't bother.? No one | |||
? | |||
else who reads this babble has anything worthwhile to say.</div> | |||
Okay, there is a small change.? Did you catch it? | Okay, there is a small change.? Did you catch it? | ||
The usage of <tt>the_category()</tt> template tag, the parameter that sets the [[WordPress:Separating_Categories|separator between the list of categories]] where the post belongs, was changed from a '''comma (,)''' to the word '''"and"'''.? It makes more sense in this situation. | The usage of <tt>the_category()</tt> template tag, the parameter that sets the ? | ||
? | |||
[[WordPress:Separating_Categories|separator between the list of categories]] where the post ? | |||
? | |||
belongs, was changed from a '''comma (,)''' to the word '''"and"'''.? It makes more sense in ? | |||
? | |||
this situation. | |||
? | |||
好了,有一點小的變化,你發(fā)現(xiàn)了嗎? | |||
? | |||
<tt>the_category()</tt>模板標簽的使用,設置[[WordPress:Separating_Categories|分類列表分離 | |||
? | |||
器]]的參數(shù),文章所在的地方,從一個'''逗號 (,)'''更改為單詞'''"and"''',這樣它更加有意義了。 | |||
Now, you can also cut the chatter and make your ''post meta data'' short and sweet: | Now, you can also cut the chatter and make your ''post meta data'' short and sweet: | ||
<pre>POSTED: <?php the_time('m/j/y g:i A') ?><br /> | |||
FILED AS: <?php the_category(', ') ?><br /> | |||
COMMENTS FEED: <?php comments_rss_link('RSS 2.0'); ?></pre> | |||
現(xiàn)在可以中斷一下,讓你的''文章 meta數(shù)據(jù)''更短,更有味道: | |||
<pre>POSTED: <?php the_time('m/j/y g:i A') ?><br /> | <pre>POSTED: <?php the_time('m/j/y g:i A') ?><br /> | ||
第59行: | 第262行: | ||
Here is a very short list of your ''post meta data'': | Here is a very short list of your ''post meta data'': | ||
<div style="border:1px solid #afafca; margin: 10px; width: 50%; padding:20px">POSTED: 05/12/04 9:35 AM | <div style="border:1px solid #afafca; margin: 10px; width: 50%; padding:20px">POSTED: ? | ||
? | |||
05/12/04 9:35 AM | |||
FILED AS: [[WordPress:#Changing the Text|News]], [[WordPress:#Changing the Text|Answers]] | |||
COMMENTS FEED: [[WordPress:#Changing the Text|RSS 2.0]]</div> | |||
? | |||
這是你的''文章 meta數(shù)據(jù)''中很短的一個列表: | |||
? | |||
<div style="border:1px solid #afafca; margin: 10px; width: 50%; padding:20px">POSTED: | |||
? | |||
05/12/04 9:35 AM | |||
FILED AS: [[WordPress:#Changing the Text|News]], [[WordPress:#Changing the Text|Answers]] | FILED AS: [[WordPress:#Changing the Text|News]], [[WordPress:#Changing the Text|Answers]] | ||
COMMENTS FEED: [[WordPress:#Changing the Text|RSS 2.0]]</div> | COMMENTS FEED: [[WordPress:#Changing the Text|RSS 2.0]]</div> | ||
第65行: | 第278行: | ||
==Changing the Time and Date== | ==Changing the Time and Date== | ||
There are many ways to change the time and date within your ''post meta data'' to reflect a more appropriate use for your website or your cultural timekeeping methods.? For example, in much of the world, the date is not ''month day, year'' but ''day month year''.? In the ''post meta data'', you would change the template tag <tt>[[WordPress:Template Tags/the_time|the_time()]]</tt> so the paramters would show "Monday, 21 February 2005": | There are many ways to change the time and date within your ''post meta data'' to reflect a ? | ||
? | |||
more appropriate use for your website or your cultural timekeeping methods.? For example, in ? | |||
? | |||
much of the world, the date is not ''month day, year'' but ''day month year''.? In the ? | |||
? | |||
''post meta data'', you would change the template tag <tt>[[WordPress:Template ? | |||
? | |||
Tags/the_time|the_time()]]</tt> so the paramters would show "Monday, 21 February 2005": | |||
? <?php the_time('1, jS F Y') ?> | ? <?php the_time('1, jS F Y') ?> | ||
To add more interesting information to your ''post meta data'' there are several [[WordPress:Glossary#Plugin|plugins]] available which generate the date the post was last modified.? Two such ''plugins'' are [http://guff.szub.net/2005/02/22/post-updated/ Kaf Oseo's Post Updated] and [http://dev.wp-plugins.org/browser/last-modified/trunk/ Nick Momrik's Last Modified]. In the following example, using various ways of [[WordPress:Formatting_Date_and_Time|manipulating time]] with PHP tags, we'll add Nick Momrik's ''plugin'' to the mix, <tt>mdv_last_modified()</tt>: | ? | ||
==更改日期和時間== | |||
? | |||
''文章 meta數(shù)據(jù)''中有很多種方法更改時間和日期,來反映出對你的網(wǎng)站或者是你時間文化更合適的用 | |||
? | |||
法,舉個例子,世界上很多地方不是''月 日, 年''而是''日 月, 年''。在''文章 meta數(shù)據(jù)''中,你可 | |||
? | |||
以改變<tt>[[WordPress:Template Tags/the_time|the_time()]]</tt>模板標簽,這樣參數(shù)就會顯 | |||
? | |||
示"Monday, 21 February 2005"了: | |||
? | |||
<?php the_time('1, jS F Y') ?> | |||
? | |||
To add more interesting information to your ''post meta data'' there are several ? | |||
? | |||
[[WordPress:Glossary#Plugin|plugins]] available which generate the date the post was last ? | |||
? | |||
modified.? Two such ''plugins'' are [http://guff.szub.net/2005/02/22/post-updated/ Kaf ? | |||
? | |||
Oseo's Post Updated] and [http://dev.wp-plugins.org/browser/last-modified/trunk/ Nick ? | |||
? | |||
Momrik's Last Modified]. In the following example, using various ways of ? | |||
? | |||
[[WordPress:Formatting_Date_and_Time|manipulating time]] with PHP tags, we'll add Nick ? | |||
? | |||
Momrik's ''plugin'' to the mix, <tt>mdv_last_modified()</tt>: | |||
? | |||
<pre><div class="postmetadata">This post was written on what I | |||
think was a <?php the_time('l'); ?>, but I know it was | |||
the <?php the_time('jS'); ?> day in the month | |||
of <?php the_time('F'); ?> in the year of | |||
<?php the_time('Y'); ?>, though I messed around | |||
with this on the <?php mdv_last_modified('dS'); ?> day | |||
of <?php mdv_last_modified('F'); ?> in | |||
<?php mdv_last_modified('Y'); ?>, a not-so-busy | |||
<?php mdv_last_modified('l'); ?> when I had nothing | |||
better to do.</p></div></pre> | |||
? | |||
想加入更多有趣的信息到''文章 meta數(shù)據(jù)''中,有幾種插件可以使用,它們可以得到文章最后更改的時 | |||
? | |||
間。兩種這樣的''插件''是[http://guff.szub.net/2005/02/22/post-updated/ Kaf Oseo's Post | |||
? | |||
Updated] 和[http://dev.wp-plugins.org/browser/last-modified/trunk/ Nick Momrik's Last | |||
? | |||
Modified],在下邊的例子中,使用[[WordPress:Formatting_Date_and_Time|manipulating time]]帶有 | |||
? | |||
PHP標簽的不同方法,我們會把Nick Momrik的''插件''加入混合,<tt>mdv_last_modified()</tt>: | |||
<pre><div class="postmetadata">This post was written on what I ? | <pre><div class="postmetadata">This post was written on what I ? | ||
第84行: | 第351行: | ||
Which would result in: | Which would result in: | ||
<div style="border:1px solid #afafca; margin: 10px; padding:20px">This post was written on what I think was a Tuesday, but I know it was the 15th day in the month of February in the year of 2004, though I messed around with this on the 10th day of August in 2004, a not-so-busy Thursday when I had nothing better to do.</div> | <div style="border:1px solid #afafca; margin: 10px; padding:20px">This post was written on ? | ||
? | |||
what I think was a Tuesday, but I know it was the 15th day in the month of February in the ? | |||
? | |||
year of 2004, though I messed around with this on the 10th day of August in 2004, a not-so- | |||
? | |||
busy Thursday when I had nothing better to do.</div> | |||
? | |||
顯示結果如下: | |||
? | |||
<div style="border:1px solid #afafca; margin: 10px; padding:20px">This post was written on | |||
? | |||
what I think was a Tuesday, but I know it was the 15th day in the month of February in the | |||
? | |||
year of 2004, though I messed around with this on the 10th day of August in 2004, a not-so- | |||
? | |||
busy Thursday when I had nothing better to do.</div> | |||
== Adding Template Tags == | == Adding Template Tags == | ||
So far, you've covered only three of the many template tags you can add to your ''post meta data''. You can add the <tt>[[WordPress:Template Tags/the_title|the_title()]]</tt> to get the title of the post.? If you want the author's name, you can add <tt>[[WordPress:Template Tags/the_author|the_author()]]</tt> and even the author's email with <tt> | So far, you've covered only three of the many template tags you can add to your ''post meta ? | ||
? | |||
data''. You can add the <tt>[[WordPress:Template Tags/the_title|the_title()]]</tt> to get ? | |||
? | |||
the title of the post.? If you want the author's name, you can add <tt>[[WordPress:Template ? | |||
? | |||
Tags/the_author|the_author()]]</tt> and even the author's email with <tt> | |||
What if you want to include more basic information like the title of the website using <tt>[[WordPress:Template Tags/bloginfo|bloginfo()]]</tt>, or [[WordPress:Next_and_Previous_Links|navigation help]] like the <tt>[[WordPress:Template Tags/previous_post|previous_post()]]</tt> and <tt>[[WordPress:Template Tags/next_post|next_post()]]</tt>? We're using the next and previous post template tags to list posts within the same category, available to users of WordPress 1.5.1.3+. These are just a few examples of the many possible uses of template tags in your ''post meta data'' ? | [[WordPress:Template Tags/the_author_email|the_author_email()]]</tt>. Want a link to all the | ||
? | |||
posts written by a specific author?? That can be arranged with the <tt>[[WordPress:Template | |||
? | |||
Tags/the_author_posts_link|the_author_posts_link()]]</tt>. | |||
? | |||
== 添加模板標簽 == | |||
? | |||
到目前為止,你涉及了可以加入''文章 meta數(shù)據(jù)''的僅僅三種標簽。你可以添加<tt> | |||
? | |||
[[WordPress:Template Tags/the_title|the_title()]]</tt>來得到文章的標題。如果你想要作者的名字 | |||
? | |||
,你可以添加<tt>[[WordPress:Template Tags/the_author|the_author()]]</tt>,還可以添加<tt> | |||
? | |||
[[WordPress:Template Tags/the_author_email|the_author_email()]]</tt>以得到作者的電子郵件。想 | |||
? | |||
要某個作者的所有文章的連接?可以使用<tt>[[WordPress:Template | |||
? | |||
ags/the_author_posts_link|the_author_posts_link()]]</tt>來安排妥當。 | |||
? | |||
What if you want to include more basic information like the title of the website using <tt> | |||
? | |||
[[WordPress:Template Tags/bloginfo|bloginfo()]]</tt>, or ? | |||
? | |||
[[WordPress:Next_and_Previous_Links|navigation help]] like the <tt>[[WordPress:Template ? | |||
? | |||
Tags/previous_post|previous_post()]]</tt> and <tt>[[WordPress:Template ? | |||
? | |||
Tags/next_post|next_post()]]</tt>? We're using the next and previous post template tags to ? | |||
? | |||
list posts within the same category, available to users of WordPress 1.5.1.3+. These are ? | |||
? | |||
just a few examples of the many possible uses of template tags in your ''post meta data'' ? | |||
? | |||
如果你想包括更基本的信息比如網(wǎng)站使用的標題,使用<tt>[[WordPress:Template | |||
? | |||
Tags/bloginfo|bloginfo()]]</tt>或者[[WordPress:Next_and_Previous_Links|導航幫助]]如<tt> | |||
? | |||
[[WordPress:Template Tags/previous_post|previous_post()]]</tt>和<tt>[[WordPress:Template | |||
? | |||
Tags/next_post|next_post()]]</tt>?我們使用WordPress 1.5.1.3+的使用者可用的,上一個和下一個 | |||
? | |||
文章模板標簽來列出同一列表中的文章。這些只是''文章 meta數(shù)據(jù)''中很多可能的模板標簽用法的幾個 | |||
? | |||
例子。 | |||
In the most simplest of usages, the ''post meta data'' could be listed as: | In the most simplest of usages, the ''post meta data'' could be listed as: | ||
<pre>POST TITLE: <?php the_title(); ?><br /> | |||
AUTHOR: <?php the_author(); ?><br /> | |||
POSTED: <?php the_time('jS F Y') ?><br /> | |||
FILED AS: <?php the_category(', ') ?><br /> | |||
COMMENT FEED: <?php comments_rss_link('RSS 2.0'); ?><br /> | |||
PREVIOUS: <?php previous_post('%', '', 'yes', 'yes'); ?><br /> | |||
NEXT: <?php next_post('%', '', 'yes', 'yes'); ?></pre> | |||
在最簡單的用法中,''文章 meta數(shù)據(jù)''可以如下列出 | |||
<pre>POST TITLE: <?php the_title(); ?><br /> | <pre>POST TITLE: <?php the_title(); ?><br /> | ||
第104行: | 第447行: | ||
And would look like this: | And would look like this: | ||
<div style="border:1px solid #afafca; width: 50%; margin: 10px; padding:20px">POST TITLE: [[WordPress:#Adding Template Tags|WordPress Makes Me Smile]]<br /> | <div style="border:1px solid #afafca; width: 50%; margin: 10px; padding:20px">POST TITLE: ? | ||
? | |||
[[WordPress:#Adding Template Tags|WordPress Makes Me Smile]]<br /> | |||
AUTHOR: [[WordPress:#Adding Template Tags|Harriet Smith]]<br /> | |||
POSTED: 20 April 2004<br /> | |||
FILED AS: [[WordPress:#Adding Template Tags|WordPress]], [[WordPress:#Adding Template | |||
? | |||
Tags|News]]<br /> | |||
COMMENT FEED: [[WordPress:#Adding Template Tags|RSS 2.0]]<br /> | |||
PREVIOUS: [[WordPress:#Adding Template Tags|Things to Do With WordPress]]<br /> | |||
NEXT: [[WordPress:#Adding Template Tags|Why I Like WordPress]]</div> | |||
? | |||
顯示如下: | |||
? | |||
<div style="border:1px solid #afafca; width: 50%; margin: 10px; padding:20px">POST TITLE: | |||
? | |||
[[WordPress:#Adding Template Tags|WordPress Makes Me Smile]]<br /> | |||
AUTHOR: [[WordPress:#Adding Template Tags|Harriet Smith]]<br /> | AUTHOR: [[WordPress:#Adding Template Tags|Harriet Smith]]<br /> | ||
POSTED: 20 April 2004<br /> | POSTED: 20 April 2004<br /> | ||
FILED AS: [[WordPress:#Adding Template Tags|WordPress]], [[WordPress:#Adding Template Tags|News]]<br /> | FILED AS: [[WordPress:#Adding Template Tags|WordPress]], [[WordPress:#Adding Template ? | ||
? | |||
Tags|News]]<br /> | |||
COMMENT FEED: [[WordPress:#Adding Template Tags|RSS 2.0]]<br /> | COMMENT FEED: [[WordPress:#Adding Template Tags|RSS 2.0]]<br /> | ||
PREVIOUS: [[WordPress:#Adding Template Tags|Things to Do With WordPress]]<br /> | PREVIOUS: [[WordPress:#Adding Template Tags|Things to Do With WordPress]]<br /> | ||
NEXT: [[WordPress:#Adding Template Tags|Why I Like WordPress]]</div> | NEXT: [[WordPress:#Adding Template Tags|Why I Like WordPress]]</div> | ||
If you want this in your sidebar, and you want a more conversational style, then in your [[WordPress:Templates|template file]], <tt>sidebar.php</tt>, find a good spot to put the following: | If you want this in your sidebar, and you want a more conversational style, then in your ? | ||
? | |||
[[WordPress:Templates|template file]], <tt>sidebar.php</tt>, find a good spot to put the ? | |||
? | |||
following: | |||
? | |||
<pre><div class="postmetadata"><p>You are reading the article, | |||
<?php the_title(); ?>, on our website, <?php bloginfo('name'); ?>.? | |||
This article was written on <?php the_time('jS F Y') ?>, in | |||
Seattle, Washington, and you can find similar articles in | |||
the <?php the_category(' and ') ?> categories, or more articles | |||
by <?php |the_author_posts_link() ?>, if you enjoyed this article.? | |||
If you have any comments about this article, you can contact | |||
<?php the_author() ?> by <a href="mailto:<?php the_author_email(); ?>"> | |||
email</a>, or leave a comment below.? You can also follow comments | |||
made on this article via our <?php comments_rss_link('RSS 2.0'); ?> | |||
feed.</p> | |||
<p>If you would like to continue reading more, | |||
<?php previous_post('the previous article on our site is called %', ' ', 'yes', 'yes'); ?> | |||
<?php next_post(' and the next article is called %', ' ', 'yes', 'yes'); ?>. | |||
? Thank you for visiting our site.</p></div></pre> | |||
? | |||
如果你想讓這些內容顯示在邊欄中,而且你想要一個會話式的樣式,那么在你的[[WordPress:Templates| | |||
? | |||
模板文件]]中,<tt>sidebar.php</tt>,找一個地方輸入以下內容: | |||
<pre><div class="postmetadata"><p>You are reading the article, ? | <pre><div class="postmetadata"><p>You are reading the article, ? | ||
第132行: | 第517行: | ||
This example, if styled in a narrow column found on most sidebars, would look like this: | This example, if styled in a narrow column found on most sidebars, would look like this: | ||
<div style="border:1px solid #afafca; width: 40%; margin: 10px; padding:20px; font-size: 95%">You are reading the article, [[WordPress:#Adding Template Tags|WordPress Makes Me Smile]], on our website, [[WordPress:#Adding Template Tags|Talking Blog]].? This article was written on May 15, 2004, in Seattle, Washington, and you can find similar articles in the | <div style="border:1px solid #afafca; width: 40%; margin: 10px; padding:20px; font-size: ? | ||
? | |||
95%">You are reading the article, [[WordPress:#Adding Template Tags|WordPress Makes Me ? | |||
? | |||
Smile]], on our website, [[WordPress:#Adding Template Tags|Talking Blog]].? This article was ? | |||
? | |||
written on May 15, 2004, in Seattle, Washington, and you can find similar articles in the ? | |||
[[WordPress:#Adding Template Tags|WordPress]] and [[WordPress:#Adding Template Tags|Blog]] ? | |||
This is just the beginning.? There are many ways you can [[WordPress:Blog_Design_and_Layout|style your ''post meta data'']]; by putting it in a box, by making it part of the text, by having it in a list...it's up to your imagination how you want to style your ''post meta data'', and what information you want to share with your public about your posts. | categories, or more articles by [[WordPress:#Adding Template Tags|Harriet Smith]], if you | ||
? | |||
enjoyed this article.? If you have any comments about this article, you can contact Harriet | |||
? | |||
Smith by [[WordPress:#Adding Template Tags|email]], or leave a comment below.? You can also | |||
? | |||
follow comments made on this article via our [[WordPress:#Adding Template Tags|RSS 2.0]] | |||
? | |||
feed. | |||
? | |||
If you would like to continue reading more, the previous article on our site is called | |||
? | |||
[[WordPress:#Adding Template Tags|Things To Do With WordPress]] and the next article is | |||
? | |||
called [[WordPress:#Adding Template Tags|Why I Like WordPress]].? Thank you for visiting our | |||
? | |||
site.</div> | |||
? | |||
這個例子如果被規(guī)劃在一個大多數(shù)邊欄的窄欄目中,將顯示如下: | |||
? | |||
<div style="border:1px solid #afafca; width: 40%; margin: 10px; padding:20px; font-size: | |||
? | |||
95%">You are reading the article, [[WordPress:#Adding Template Tags|WordPress Makes Me | |||
? | |||
Smile]], on our website, [[WordPress:#Adding Template Tags|Talking Blog]].? This article was | |||
? | |||
written on May 15, 2004, in Seattle, Washington, and you can find similar articles in the | |||
? | |||
[[WordPress:#Adding Template Tags|WordPress]] and [[WordPress:#Adding Template Tags|Blog]] | |||
? | |||
categories, or more articles by [[WordPress:#Adding Template Tags|Harriet Smith]], if you | |||
? | |||
enjoyed this article.? If you have any comments about this article, you can contact Harriet | |||
? | |||
Smith by [[WordPress:#Adding Template Tags|email]], or leave a comment below.? You can also | |||
? | |||
follow comments made on this article via our [[WordPress:#Adding Template Tags|RSS 2.0]] | |||
? | |||
feed. | |||
? | |||
If you would like to continue reading more, the previous article on our site is called | |||
? | |||
[[WordPress:#Adding Template Tags|Things To Do With WordPress]] and the next article is | |||
? | |||
called [[WordPress:#Adding Template Tags|Why I Like WordPress]].? Thank you for visiting our | |||
? | |||
site.</div> | |||
? | |||
This is just the beginning.? There are many ways you can ? | |||
? | |||
[[WordPress:Blog_Design_and_Layout|style your ''post meta data'']]; by putting it in a box, ? | |||
? | |||
by making it part of the text, by having it in a list...it's up to your imagination how you ? | |||
? | |||
want to style your ''post meta data'', and what information you want to share with your ? | |||
? | |||
public about your posts. | |||
? | |||
這只是開始,有很多[[WordPress:Blog_Design_and_Layout|設計你的''文章 meta數(shù)據(jù)'']]的方法:通過 | |||
? | |||
把它放入文本框,把它變?yōu)槲谋镜囊徊糠?,把它在列表中列出等等。這都取決于你的希望如何設計你的'' | |||
? | |||
文章 meta數(shù)據(jù)'',和你想通過你的文章分享什么樣的信息。 | |||
==More Resources== | ==More Resources== | ||
第148行: | 第601行: | ||
* [[WordPress:Next and Previous Links]] | * [[WordPress:Next and Previous Links]] | ||
* [[WordPress:WordPress Feeds]] | * [[WordPress:WordPress Feeds]] | ||
==更多資源== | |||
* [[WordPress:Stepping Into Template Tags|走進模板標簽]] | |||
* [[WordPress:Formatting Date and Time|設置日期和時間格式]] | |||
* [[WordPress:Separating Categories|分開分類類別]] | |||
* [[WordPress:Template Tags|模板標簽]] | |||
* [[WordPress:Styling Lists with CSS|使用CSS設計列表]] | |||
* [[WordPress:Good Navigation Links|好的導航連接]] | |||
* [[WordPress:Next and Previous Links|下一個和上一個連接]] | |||
* [[WordPress:WordPress Feeds|WordPress Feeds]] |
2008年4月14日 (一) 16:48的版本
The post meta data is the "administrative" information you provide to viewers about
each post. This information usually includes the author of the
post, when it was written (or posted), and how the author
categorized that particular post. This lesson will show you
some different ways to change your Theme design to display these important pieces of
information in the manner you desire.
文章 meta數(shù)據(jù)是提供給訪問者的每個文章的"管理的"信息。這個
信息通常包括作者、寫(或是發(fā)布)的時間和作者如何分類這篇文章。
這一課將告訴你一些改變主題設計,使用你想要的方法來顯示這些重要信息的方法。
In many cases, the post meta data is positioned immediately following the post itself,
though some Themes are designed to place this information at the top of the post, other
designs feature the post meta data in the top or bottom of the sidebar, and some designs
even place the information in the footer. Essentially, post meta data can be styled in
many different ways and with a variety of details.
在很多情況下,文章 meta數(shù)據(jù)會在文章自身形成后立即形成,一些主題設計成把這些信息放在文章
頂部,別的一些主題可能會放在頂部或者底部的邊欄中,還有一寫主題甚至設計成放在頁腳。如果需要的 話文章 meta數(shù)據(jù)可以設計成不同的方式,帶有不同的多種細節(jié)內容。
Default Usage
The default WordPress Theme places the post meta data basic
information and tags below the post in a box, before the comments. A condensed version of
the code looks like this:
<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.</small>
默認用法
默認的WordPress 主題把文章 meta數(shù)據(jù)這基本信息和標簽定位在文章 下部分,在評論之前的一個信息框中。簡化的代碼如下:
<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.</small>
The output result looks like this:
entry was posted on Monday, February 12, 2003 at 11:32 and is filed under
[[WordPress:#Default Usage|WordPress Lessons]], [[WordPress:#Default Usage|Things to Know]].
You can follow any responses to this entry though the [[WordPress:#Default Usage|RSS 2.0]]
feed.這輸出結果如下:
entry was posted on Monday, February 12, 2003 at 11:32 and is filed under
[[WordPress:#Default Usage|WordPress Lessons]], [[WordPress:#Default Usage|Things to Know]].
You can follow any responses to this entry though the [[WordPress:#Default Usage|RSS 2.0]]
feed.There are three template tags used in the post meta data.
One, the_time(), is used twice with different
results. The other two tags get the information about the categories and the link to the
RSS feed from the database.
在文章 meta數(shù)據(jù)中有3種模板標簽可以使用,第一,
the_time(),使用兩次帶有不同的結果,另外兩種標簽是
得到關于分類的信息和從數(shù)據(jù)庫到RSS feed的連接。
The template tag for the_time() can be set up with a variety of parameters to tell
the time and date of the post from information drawn from the database. In the first usage,
the parameters l, F jS, Y pull the post's date into a format that gives the
weekday, month, date, and year. In the second usage, there are no parameters,
therefore it just returns the time when the post was saved. You will experiment with these
below in [[WordPress:#Changing the Time and Date|Changing the Time and Date]].
the_time()的模板標簽有很多顯示數(shù)據(jù)庫中的文章時間和日期的參數(shù)可以設置。第一種用法,
l, F jS, Y參數(shù),把文章的日期設置成一個周日, 月, 日, and 年的格式,第二種用
法,沒有任何參數(shù),這樣它只是返回文章是什么時候保存的值。你在下面的[[WordPress:#Changing the
Time and Date|更改時間和日期]]中就會體會到。
The template tag the_category() displays
the categories that the post belongs to. This template tag
can be modified to feature different text, graphics and symbols between the graphics, and
may even use a plugin to display graphics in place of the words. There are many ways to
style these. In this example, the categories are listed with
模板標簽the_category()顯示文章所屬的
分類。這個模板標簽可以更改來適應不同的文本、圖片、圖片之間的
符號,還可以使用插件來代替文字顯示圖片。有很多種設計方法。在這個例子中列出的
The last tag is the comments_rss_link()
which uses the parameter RSS 2.0 to identify the type of
feed being used. You can also [[WordPress:Customizing
Feeds|customize the feed tag]], changing the way it displays the link information about the
feed and type, or even have it feature feed icons instead of text.
最后一個標簽是comments_rss_link(),使
用參數(shù)RSS 2.0來識別使用的feed類型。你也可以
自定義feed標簽,更改它的顯示有關feed和模型的連接信息的方式,
或者使用feed圖標來代替文本。
Changing the Text
Let's start to rearrange your post meta data with small steps. The first step is to
change the text but not the tags. After all, this is your website and you want it to say
things your way, right? This example makes the post meta data a little more
conversational:
<small>I slaved away at the computer on <?php the_time('l, F jS, Y') ?> at the ridiculous time of <?php the_time() ?> when I could have been doing something much more productive. I slapped this thing into the <?php the_category(' and ') ?> categories, just to make you think I have some organizational skills. If you can really be bothered, you can keep track of what people have to say about my silly writings through the <?php comments_rss_link('RSS 2.0'); ?> feed, but I wouldn't bother. No one else who reads this babble has anything worthwhile to say.</small>
更改文本
讓我們開始重新排版你的文章 meta數(shù)據(jù)。第一步是更改文本而不是標簽。畢竟,這是你的網(wǎng)站,你
希望它使用你的方式來排列,對吧?這個例子讓文章 meta數(shù)據(jù)更加會話式:
<small>I slaved away at the computer on <?php the_time('l, F jS, Y') ?> at the ridiculous time of <?php the_time() ?> when I could have been doing something much more productive. I slapped this thing into the <?php the_category(' and ') ?> categories, just to make you think I have some organizational skills. If you can really be bothered, you can keep track of what people have to say about my silly writings through the <?php comments_rss_link('RSS 2.0'); ?> feed, but I wouldn't bother. No one else who reads this babble has anything worthwhile to say.</small>
This would result in:
computer on Monday, February 12, 2003 at the ridiculous time of 11:32. when I could have
been doing something much more productive. I slapped this thing into the
[[WordPress:#Changing the Text|WordPress Lessons]] and [[WordPress:#Changing the Text|Things
to Know]]. categories, just to make you think I have some organizational skills. If you can
really be bothered, you can keep track of what people have to say about my silly writings
through the [[WordPress:#Changing the Text|RSS 2.0]] feed, but I wouldn't bother. No one
else who reads this babble has anything worthwhile to say.顯示結果如下:
computer on Monday, February 12, 2003 at the ridiculous time of 11:32. when I could have
been doing something much more productive. I slapped this thing into the
[[WordPress:#Changing the Text|WordPress Lessons]] and [[WordPress:#Changing the Text|Things
to Know]]. categories, just to make you think I have some organizational skills. If you can
really be bothered, you can keep track of what people have to say about my silly writings
through the [[WordPress:#Changing the Text|RSS 2.0]] feed, but I wouldn't bother. No one
else who reads this babble has anything worthwhile to say.Okay, there is a small change. Did you catch it?
The usage of the_category() template tag, the parameter that sets the
separator between the list of categories where the post
belongs, was changed from a comma (,) to the word "and". It makes more sense in
this situation.
好了,有一點小的變化,你發(fā)現(xiàn)了嗎?
the_category()模板標簽的使用,設置分類列表分離 器的參數(shù),文章所在的地方,從一個逗號 (,)更改為單詞"and",這樣它更加有意義了。
Now, you can also cut the chatter and make your post meta data short and sweet:
POSTED: <?php the_time('m/j/y g:i A') ?><br /> FILED AS: <?php the_category(', ') ?><br /> COMMENTS FEED: <?php comments_rss_link('RSS 2.0'); ?>
現(xiàn)在可以中斷一下,讓你的文章 meta數(shù)據(jù)更短,更有味道:
POSTED: <?php the_time('m/j/y g:i A') ?><br /> FILED AS: <?php the_category(', ') ?><br /> COMMENTS FEED: <?php comments_rss_link('RSS 2.0'); ?>
Here is a very short list of your post meta data:
05/12/04 9:35 AM FILED AS: [[WordPress:#Changing the Text|News]], [[WordPress:#Changing the Text|Answers]]
COMMENTS FEED: [[WordPress:#Changing the Text|RSS 2.0]]這是你的文章 meta數(shù)據(jù)中很短的一個列表:
05/12/04 9:35 AM FILED AS: [[WordPress:#Changing the Text|News]], [[WordPress:#Changing the Text|Answers]]
COMMENTS FEED: [[WordPress:#Changing the Text|RSS 2.0]]Changing the Time and Date
There are many ways to change the time and date within your post meta data to reflect a
more appropriate use for your website or your cultural timekeeping methods. For example, in
much of the world, the date is not month day, year but day month year. In the
post meta data, you would change the template tag [[WordPress:Template
Tags/the_time|the_time()]] so the paramters would show "Monday, 21 February 2005":
<?php the_time('1, jS F Y') ?>
更改日期和時間
文章 meta數(shù)據(jù)中有很多種方法更改時間和日期,來反映出對你的網(wǎng)站或者是你時間文化更合適的用
法,舉個例子,世界上很多地方不是月 日, 年而是日 月, 年。在文章 meta數(shù)據(jù)中,你可
以改變the_time()模板標簽,這樣參數(shù)就會顯
示"Monday, 21 February 2005"了:
<?php the_time('1, jS F Y') ?>
To add more interesting information to your post meta data there are several
plugins available which generate the date the post was last
modified. Two such plugins are [http://guff.szub.net/2005/02/22/post-updated/ Kaf
Oseo's Post Updated] and [http://dev.wp-plugins.org/browser/last-modified/trunk/ Nick
Momrik's Last Modified]. In the following example, using various ways of
manipulating time with PHP tags, we'll add Nick
Momrik's plugin to the mix, mdv_last_modified():
<div class="postmetadata">This post was written on what I think was a <?php the_time('l'); ?>, but I know it was the <?php the_time('jS'); ?> day in the month of <?php the_time('F'); ?> in the year of <?php the_time('Y'); ?>, though I messed around with this on the <?php mdv_last_modified('dS'); ?> day of <?php mdv_last_modified('F'); ?> in <?php mdv_last_modified('Y'); ?>, a not-so-busy <?php mdv_last_modified('l'); ?> when I had nothing better to do.</p></div>
想加入更多有趣的信息到文章 meta數(shù)據(jù)中,有幾種插件可以使用,它們可以得到文章最后更改的時
間。兩種這樣的插件是[http://guff.szub.net/2005/02/22/post-updated/ Kaf Oseo's Post
Updated] 和[http://dev.wp-plugins.org/browser/last-modified/trunk/ Nick Momrik's Last
Modified],在下邊的例子中,使用manipulating time帶有
PHP標簽的不同方法,我們會把Nick Momrik的插件加入混合,mdv_last_modified():
<div class="postmetadata">This post was written on what I think was a <?php the_time('l'); ?>, but I know it was the <?php the_time('jS'); ?> day in the month of <?php the_time('F'); ?> in the year of <?php the_time('Y'); ?>, though I messed around with this on the <?php mdv_last_modified('dS'); ?> day of <?php mdv_last_modified('F'); ?> in <?php mdv_last_modified('Y'); ?>, a not-so-busy <?php mdv_last_modified('l'); ?> when I had nothing better to do.</p></div>
Which would result in:
what I think was a Tuesday, but I know it was the 15th day in the month of February in the
year of 2004, though I messed around with this on the 10th day of August in 2004, a not-so-
busy Thursday when I had nothing better to do.顯示結果如下:
what I think was a Tuesday, but I know it was the 15th day in the month of February in the
year of 2004, though I messed around with this on the 10th day of August in 2004, a not-so-
busy Thursday when I had nothing better to do.Adding Template Tags
So far, you've covered only three of the many template tags you can add to your post meta
data. You can add the the_title() to get
the title of the post. If you want the author's name, you can add [[WordPress:Template
Tags/the_author|the_author()]] and even the author's email with
the_author_email(). Want a link to all the
posts written by a specific author? That can be arranged with the [[WordPress:Template
Tags/the_author_posts_link|the_author_posts_link()]].
添加模板標簽
到目前為止,你涉及了可以加入文章 meta數(shù)據(jù)的僅僅三種標簽。你可以添加
the_title()來得到文章的標題。如果你想要作者的名字
,你可以添加the_author(),還可以添加
the_author_email()以得到作者的電子郵件。想
要某個作者的所有文章的連接?可以使用[[WordPress:Template
ags/the_author_posts_link|the_author_posts_link()]]來安排妥當。
What if you want to include more basic information like the title of the website using
bloginfo(), or
navigation help like the [[WordPress:Template
Tags/previous_post|previous_post()]] and [[WordPress:Template
Tags/next_post|next_post()]]? We're using the next and previous post template tags to
list posts within the same category, available to users of WordPress 1.5.1.3+. These are
just a few examples of the many possible uses of template tags in your post meta data
如果你想包括更基本的信息比如網(wǎng)站使用的標題,使用[[WordPress:Template
Tags/bloginfo|bloginfo()]]或者導航幫助如
previous_post()和[[WordPress:Template
Tags/next_post|next_post()]]?我們使用WordPress 1.5.1.3+的使用者可用的,上一個和下一個
文章模板標簽來列出同一列表中的文章。這些只是文章 meta數(shù)據(jù)中很多可能的模板標簽用法的幾個
例子。
In the most simplest of usages, the post meta data could be listed as:
POST TITLE: <?php the_title(); ?><br /> AUTHOR: <?php the_author(); ?><br /> POSTED: <?php the_time('jS F Y') ?><br /> FILED AS: <?php the_category(', ') ?><br /> COMMENT FEED: <?php comments_rss_link('RSS 2.0'); ?><br /> PREVIOUS: <?php previous_post('%', '', 'yes', 'yes'); ?><br /> NEXT: <?php next_post('%', '', 'yes', 'yes'); ?>
在最簡單的用法中,文章 meta數(shù)據(jù)可以如下列出
POST TITLE: <?php the_title(); ?><br /> AUTHOR: <?php the_author(); ?><br /> POSTED: <?php the_time('jS F Y') ?><br /> FILED AS: <?php the_category(', ') ?><br /> COMMENT FEED: <?php comments_rss_link('RSS 2.0'); ?><br /> PREVIOUS: <?php previous_post('%', '', 'yes', 'yes'); ?><br /> NEXT: <?php next_post('%', '', 'yes', 'yes'); ?>
And would look like this:
[[WordPress:#Adding Template Tags|WordPress Makes Me Smile]]
AUTHOR: [[WordPress:#Adding Template Tags|Harriet Smith]]
POSTED: 20 April 2004
FILED AS: [[WordPress:#Adding Template Tags|WordPress]], [[WordPress:#Adding Template
Tags|News]]
COMMENT FEED: [[WordPress:#Adding Template Tags|RSS 2.0]]
PREVIOUS: [[WordPress:#Adding Template Tags|Things to Do With WordPress]]
顯示如下:
[[WordPress:#Adding Template Tags|WordPress Makes Me Smile]]
AUTHOR: [[WordPress:#Adding Template Tags|Harriet Smith]]
POSTED: 20 April 2004
FILED AS: [[WordPress:#Adding Template Tags|WordPress]], [[WordPress:#Adding Template
Tags|News]]
COMMENT FEED: [[WordPress:#Adding Template Tags|RSS 2.0]]
PREVIOUS: [[WordPress:#Adding Template Tags|Things to Do With WordPress]]
If you want this in your sidebar, and you want a more conversational style, then in your
template file, sidebar.php, find a good spot to put the
following:
<div class="postmetadata"><p>You are reading the article, <?php the_title(); ?>, on our website, <?php bloginfo('name'); ?>. This article was written on <?php the_time('jS F Y') ?>, in Seattle, Washington, and you can find similar articles in the <?php the_category(' and ') ?> categories, or more articles by <?php |the_author_posts_link() ?>, if you enjoyed this article. If you have any comments about this article, you can contact <?php the_author() ?> by <a href="mailto:<?php the_author_email(); ?>"> email</a>, or leave a comment below. You can also follow comments made on this article via our <?php comments_rss_link('RSS 2.0'); ?> feed.</p> <p>If you would like to continue reading more, <?php previous_post('the previous article on our site is called %', ' ', 'yes', 'yes'); ?> <?php next_post(' and the next article is called %', ' ', 'yes', 'yes'); ?>. Thank you for visiting our site.</p></div>
如果你想讓這些內容顯示在邊欄中,而且你想要一個會話式的樣式,那么在你的 模板文件中,sidebar.php,找一個地方輸入以下內容:
<div class="postmetadata"><p>You are reading the article, <?php the_title(); ?>, on our website, <?php bloginfo('name'); ?>. This article was written on <?php the_time('jS F Y') ?>, in Seattle, Washington, and you can find similar articles in the <?php the_category(' and ') ?> categories, or more articles by <?php |the_author_posts_link() ?>, if you enjoyed this article. If you have any comments about this article, you can contact <?php the_author() ?> by <a href="mailto:<?php the_author_email(); ?>"> email</a>, or leave a comment below. You can also follow comments made on this article via our <?php comments_rss_link('RSS 2.0'); ?> feed.</p> <p>If you would like to continue reading more, <?php previous_post('the previous article on our site is called %', ' ', 'yes', 'yes'); ?> <?php next_post(' and the next article is called %', ' ', 'yes', 'yes'); ?>. Thank you for visiting our site.</p></div>
This example, if styled in a narrow column found on most sidebars, would look like this:
Smile]], on our website, [[WordPress:#Adding Template Tags|Talking Blog]]. This article was
written on May 15, 2004, in Seattle, Washington, and you can find similar articles in the
[[WordPress:#Adding Template Tags|WordPress]] and [[WordPress:#Adding Template Tags|Blog]]
categories, or more articles by [[WordPress:#Adding Template Tags|Harriet Smith]], if you
enjoyed this article. If you have any comments about this article, you can contact Harriet
Smith by [[WordPress:#Adding Template Tags|email]], or leave a comment below. You can also
follow comments made on this article via our [[WordPress:#Adding Template Tags|RSS 2.0]]
feed.
If you would like to continue reading more, the previous article on our site is called
[[WordPress:#Adding Template Tags|Things To Do With WordPress]] and the next article is
called [[WordPress:#Adding Template Tags|Why I Like WordPress]]. Thank you for visiting our
site.這個例子如果被規(guī)劃在一個大多數(shù)邊欄的窄欄目中,將顯示如下:
Smile]], on our website, [[WordPress:#Adding Template Tags|Talking Blog]]. This article was
written on May 15, 2004, in Seattle, Washington, and you can find similar articles in the
[[WordPress:#Adding Template Tags|WordPress]] and [[WordPress:#Adding Template Tags|Blog]]
categories, or more articles by [[WordPress:#Adding Template Tags|Harriet Smith]], if you
enjoyed this article. If you have any comments about this article, you can contact Harriet
Smith by [[WordPress:#Adding Template Tags|email]], or leave a comment below. You can also
follow comments made on this article via our [[WordPress:#Adding Template Tags|RSS 2.0]]
feed.
If you would like to continue reading more, the previous article on our site is called
[[WordPress:#Adding Template Tags|Things To Do With WordPress]] and the next article is
called [[WordPress:#Adding Template Tags|Why I Like WordPress]]. Thank you for visiting our
site.This is just the beginning. There are many ways you can
style your post meta data; by putting it in a box,
by making it part of the text, by having it in a list...it's up to your imagination how you
want to style your post meta data, and what information you want to share with your
public about your posts.
這只是開始,有很多設計你的文章 meta數(shù)據(jù)的方法:通過
把它放入文本框,把它變?yōu)槲谋镜囊徊糠?,把它在列表中列出等等。這都取決于你的希望如何設計你的
文章 meta數(shù)據(jù),和你想通過你的文章分享什么樣的信息。
More Resources
- WordPress:Stepping Into Template Tags
- WordPress:Formatting Date and Time
- WordPress:Separating Categories
- WordPress:Template Tags
- WordPress:Styling Lists with CSS
- WordPress:Good Navigation Links
- WordPress:Next and Previous Links
- WordPress:WordPress Feeds