久久精品水蜜桃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)站程序
站長人物
頁面分類
使用幫助
編輯測試
創(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)
開放平臺
WIKI程序與應(yīng)用
美國十大主機(jī)
編輯“
Theme Development
”(章節(jié))
人物百科
|
營銷百科
|
網(wǎng)賺百科
|
站長工具
|
網(wǎng)站程序
|
域名主機(jī)
|
互聯(lián)網(wǎng)公司
|
分類索引
跳轉(zhuǎn)至:
導(dǎo)航
、?
搜索
警告:
您沒有登錄。如果您做出任意編輯,您的IP地址將會公開可見。如果您
登錄
或
創(chuàng)建
一個(gè)賬戶,您的編輯將歸屬于您的用戶名,且將享受其他好處。
反垃圾檢查。
不要
加入這個(gè)!
===主題模板文件=== [[WordPress:Stepping Into Templates|Templates]] are PHP source files used to generate the pages requested by visitors. Let's look at the various templates that can be defined as part of a Theme. [[WordPress:Stepping Into Templates|模板]]是PHP原始文件,根據(jù)訪客要求,用來產(chǎn)生網(wǎng)頁的。讓我們來看看可以被定義為主題部分的不同的模板。 WordPress allows you to define separate templates for the various aspects of your weblog; however, it is not essential to have all these different template files for your blog to function fully. Templates are chosen and generated based upon the [[WordPress:Template Hierarchy]], depending upon what templates are available in a particular Theme. As a Theme developer, you can choose the amount of customization you want to implement using templates. For example, as an extreme case, you can use only one template file, called <tt>index.php</tt> as the template for ''all'' pages generated and displayed by the weblog. A more common use is to have different template files generate different results, to allow maximum customization. WordPress能夠使你為你的博客的不同部分分別定義模板;然而,使你的博客正常地運(yùn)行,并不一定需要所有的這些不同的模板文件。模板是根據(jù)[[WordPress:Template Hierarchy|模板層級]]選擇和產(chǎn)生的,取決于特別的主題中擁有什么樣的模板。作為一個(gè)主題開發(fā)者,你可以選擇你想使用模板,自定義多少內(nèi)容。例如,一個(gè)極端的例子,你可以為網(wǎng)絡(luò)日志上產(chǎn)生的和顯示的''所有的''網(wǎng)頁,只使用一個(gè)稱為<tt>index.php</tt>模板文件,作為模板。一個(gè)更加通常的用法是使用不同的模板文件產(chǎn)生不同的結(jié)果,允許最大化的自定義。 ===='''Basic Templates'''==== ===='''基本的模板'''==== At the very minimum, a WordPress Theme consists of two files: 在最小值的時(shí)候, WordPress主題包含有兩個(gè)文件: * <tt>style.css</tt> * <tt>index.php</tt> * <tt>style.css</tt> * <tt>index.php</tt> Both of these files go into the Theme's directory. The <tt>index.php</tt> [[WordPress:Stepping Into Templates|template file]] is very flexible. It can be used to include all references to the header, sidebar, footer, content, categories, archives, search, error, and other web pages generated by the user on your site. Or it can be ''subdivided'' into modular template files, each one taking on part of the workload. 這兩個(gè)文件都?xì)w屬于主題的目錄。<tt>index.php</tt> [[WordPress:Stepping Into Templates|模板文件]]非常地靈活。它可以被用來包括關(guān)于標(biāo)題,工具條,頁腳,內(nèi)容,類別,歸檔,搜索,錯(cuò)誤和你的站點(diǎn)上的用戶創(chuàng)建的其它的網(wǎng)頁的所有參數(shù)?;蛘咚梢员?'再次地分''到模模板文件,每個(gè)部分都具有一部分的工作量。 If you do not provide any other template files, WordPress will use the built-in default files. For example, if you do not have either a <tt>comments.php</tt> or <tt>comments-popup.php</tt> template file, then WordPress will automatically use the <tt>wp-comments.php</tt> and <tt>wp-comments-popup.php</tt> template files using [[WordPress:Template Hierarchy]]. These default templates may not match your Theme very well, so you probably will want to provide your own. The basic files normally used to subdivide (which go into the Theme's directory) are: 如果你沒有提供其它任何的模板文件,WordPress會使用內(nèi)置的默認(rèn)文件。例如,如果你既沒有<tt>comments.php</tt>也沒有<tt>comments-popup.php</tt>模板文件,WordPress就會使用[[WordPress:Template Hierarchy|模板層級]],自動地使用<tt>wp-comments.php</tt> 和<tt>wp-comments-popup.php</tt>模板文件。這些默認(rèn)模板可能不太匹配你的主題,因此你可能需要提供你自己的模板。用來再次地切分的基本的文件(歸屬于主題的目錄)是: * <tt>header.php</tt> * <tt>sidebar.php</tt> * <tt>footer.php</tt> * <tt>comments.php</tt> * <tt>comments-popup.php</tt> * <tt>header.php</tt> * <tt>sidebar.php</tt> * <tt>footer.php</tt> * <tt>comments.php</tt> * <tt>comments-popup.php</tt> Using these modular template files, you can put template tags within the <tt>index.php</tt> master file to include or ''get'' these units where you want them to appear in the final generated web page. 使用這些模的模板文件,你可以將這些模板標(biāo)簽放到<tt>index.php</tt>主要文件中來包括或者''得到''這些units,你想讓它們出現(xiàn)在最后產(chǎn)生的網(wǎng)頁的位置。 * To include the header, use the <tt>[[WordPress:Include Tags#The Header Template|get_header()]]</tt> template tag. *要包含標(biāo)題,請使用<tt>[[WordPress:Include Tags#The Header Template|get_header()]]</tt>模板標(biāo)簽。 * To include the sidebar, use the <tt>[[WordPress:Include Tags#The Sidebar Template|get_sidebar()]]</tt> template tag. *要包含工具條,使用<tt>[[WordPress:Include Tags#The Sidebar Template|get_sidebar()]]</tt>模板標(biāo)簽。 * To include the footer, use the <tt>[[WordPress:Include Tags#The Footer Template|get_footer()]]</tt> template tag. *要包含頁腳,使用<tt>[[WordPress:Include Tags#The Footer Template|get_footer()]]</tt> 模板標(biāo)簽。 Here is an example of the ''include'' usage: 下面是關(guān)于''包含'' 用法的一個(gè)例子: <pre><?php get_sidebar(); ?> <?php get_footer(); ?></pre> <pre><?php get_sidebar(); ?> <?php get_footer(); ?></pre> For more on how these various Templates work and how to generate different information within them, read the [[WordPress:Templates]] documentation. 關(guān)于這些不同模板怎樣運(yùn)行以及怎樣在模板里面產(chǎn)生不同信息的更多內(nèi)容,請閱讀[[WordPress:Templates|模板]]文件。 ===='''Query-based Templates'''==== ===='''以查詢?yōu)榛A(chǔ)的模板'''==== WordPress can load different [[WordPress:Stepping Into Templates|Templates]] for different ''query'' types. There are two ways to do this: as part of the built-in [[WordPress:Template Hierarchy]], and through the use of [[WordPress:Conditional Tags]] within [[WordPress:The Loop]] of a template file. WordPress可以為不同的''查詢'' 形式載入不同的[[WordPress:Stepping Into Templates|模板]]。有兩種方法可以做到這一點(diǎn):作為內(nèi)置的[[WordPress:Template Hierarchy|模板層級]]的一部分,通過在模板文件的[[WordPress:The Loop|Loop]]中使用[[WordPress:Conditional Tags|條件式標(biāo)簽]]。 To use the [[WordPress:Template Hierarchy]], you basically need to provide special-purpose Template files, which will automatically be used to override <tt>index.php</tt>. For instance, if your Theme provides a template called <tt>category.php</tt> and a category is being queried, <tt>category.php</tt> will be loaded instead of <tt>index.php</tt>. If <tt>category.php</tt> is not present, <tt>index.php</tt> is used as usual. 要使用[[WordPress:Template Hierarchy|模板層級]],你只要提供特殊用途的模板文件,這個(gè)文件會自動地覆蓋<tt>index.php</tt>。例如,如果你的主題提供一個(gè)叫做<tt>category.php</tt>的模板,并且提供一個(gè)正被查詢的類別,<tt>category.php</tt>而不是<tt>index.php</tt>將會被載入。如果<tt>category.php</tt>沒有出現(xiàn),<tt>index.php</tt>會照常使用。 You can get even more specific in the Template Hierarchy by providing a file called, for instance, <tt>category-6.php</tt> -- this file will be used rather than <tt>category.php</tt> when generating the page for the category whose ID number is 6. (You can find category ID numbers in [[WordPress:Administration_Panels#Manage_-_Change_your_content|Manage]] > [[WordPress:Administration_Panels#Categories|Categories]] if you are logged in as the site administrator in WordPress version 2.3 and below. In WordPress 2.5 the ID column was removed from the Admin panels. You can locate the category id by clicking 'Edit Category' and looking on the URL address bar for the cat_ID value. It will look '...categories.php?action=edit&cat_ID=3' where '3' is the category id). For a more detailed look at how this process works, see [[WordPress:Category Templates]]. 通過提供一個(gè)例如,稱作<tt>category-6.php</tt>的文件,你可以在模板層級中得到更加詳細(xì)的信息---當(dāng)為一個(gè)ID號碼為6的類別產(chǎn)出網(wǎng)頁的時(shí)候,這個(gè)文件而不是<tt>category.php</tt>會被用到。(如果你在WordPress2.3版本以及更低的版本中,以站點(diǎn)管理員的身份登錄,你在 [[WordPress:Administration_Panels#Manage_-_Change_your_content|管理]] > [[WordPress:Administration_Panels#Categories|類別]] 下面會看到這個(gè)類別的ID數(shù)字。在WordPress 2.5版本中,管理面板中移除了ID欄。通過點(diǎn)擊'編輯類別' ,并且查找URL地址中的cat_ID 參數(shù)值,你可以查找類別id的位置。看起來就像'...categories.php?action=edit&cat_ID=3' 其中'3'就是類別 id)。更詳細(xì)地看看這個(gè)過程是怎樣進(jìn)行的,請看看[[WordPress:Category Templates|類別模板]]。 If your Theme needs to have even more control over which Template files are used than what is provided in the [[WordPress:Template Hierarchy]], you can use [[WordPress:Conditional Tags]]. The Conditional Tag basically checks to see if some particular condition is true, within the [[WordPress:The_Loop_in_Action|WordPress Loop]], and then you can load a particular template, or put some particular text on the screen, based on that condition. 如果你的主題需要更多地控制使用的哪個(gè)模板文件而不是[[WordPress:Template Hierarchy|模板層級]]中所提供的內(nèi)容,你可以使用[[WordPress:Template Hierarchy|條件式標(biāo)簽]]。條件式標(biāo)簽基本上是用來檢查看看在[[WordPress:The_Loop_in_Action|WordPress Loop]]內(nèi)的,一些特別的條件是否是真的,然后你就可以根據(jù)那個(gè)情況,載入一個(gè)特別的模板,或者在屏面上放一些特別的文本。 For example, to generate a distinctive style sheet in a post only found within a specific category, the code might look like this: 例如,給一個(gè)特別類別中的文章創(chuàng)建一個(gè)樣式表,代碼可能看起來像這樣的: <pre><?php if (is_category(9)) { // looking for category 9 posts include(TEMPLATEPATH . '/single2.php'); } else { // put this on every other category post include(TEMPLATEPATH . '/single1.php'); } ?></pre> <pre><?php if (is_category(9)) { //查找類別9中的文章 包括(TEMPLATEPATH . '/single2.php'); } else { // 每隔一篇文章便放入這個(gè) include(TEMPLATEPATH . '/single1.php'); } ?></pre> Or, using a query, it might look like this: 或者,使用一個(gè)查詢,這個(gè)查詢可能看起來像: <pre><?php $post = $wp_query->post; if ( in_category('9') ) { include(TEMPLATEPATH . '/single2.php'); } else { include(TEMPLATEPATH . '/single1.php'); } ?></pre> <pre><?php $post = $wp_query->post; if ( in_category('9') ) { include(TEMPLATEPATH . '/single2.php'); } else { include(TEMPLATEPATH . '/single1.php'); } ?></pre> In either case, this example code will cause different templates to be used depending on the category of the particular post being displayed. Query conditions are not limited to categories, however -- see the [[WordPress:Conditional Tags]] article to look at all the options. 在上述任一例子中,代碼會產(chǎn)生不同的模板,這些模板的使用取決于類別上顯示的文章。查詢條件并不局限于類別,然而—請看看[[WordPress:Conditional Tags|條件式標(biāo)簽]]文章來看看所有的選項(xiàng)。
摘要:
請注意,您對站長百科的所有貢獻(xiàn)都可能被其他貢獻(xiàn)者編輯,修改或刪除。如果您不希望您的文字被任意修改和再散布,請不要提交。
您同時(shí)也要向我們保證您所提交的內(nèi)容是您自己所作,或得自一個(gè)不受版權(quán)保護(hù)或相似自由的來源(參閱
Wordpress-mediawiki:版權(quán)
的細(xì)節(jié))。
未經(jīng)許可,請勿提交受版權(quán)保護(hù)的作品!
取消
編輯幫助
(在新窗口中打開)
取自“
http://kktzf.com.cn/wiki/Theme_Development
”