主題存放文件夾
wp-content/themes
主題的信息
WordPress的主題信息寫在 style.css
樣式文件的頭部:
/*
Theme Name: 主題名字
Theme URL: 鏈接
Author: 作者
Author URI: 作者url
Description: 描述
Version: 版本
License: 版權(quán)說明
License URI: 版權(quán)url
Text Domain: devion
Domain Path: /languages/
Tags: 標(biāo)簽初肉,多個用半角逗號隔開
*/
主題的縮略圖
主題文件夾下面的 screenshot.png
圖片
獲取博客的基本信息
<? bloginfo("鍵名字"); ?>
<? echo get_bloginfo("鍵名字"); ?>
默認(rèn): name
- ‘name’ – 顯示在 設(shè)置 > 常規(guī) 中設(shè)置的“站點標(biāo)題”冰更。 該數(shù)據(jù)是從 wp_options 這個數(shù)據(jù)表中檢索到的 "blogname"記錄背镇。
- ‘description’ – 顯示在 設(shè)置 > 常規(guī) 中設(shè)置的“副標(biāo)題”。該數(shù)據(jù)是從 wp_options 這個數(shù)據(jù)表中檢索到的 "blogdescription" 記錄栏笆。
- ‘wpurl’ – 顯示在 設(shè)置 > 常規(guī) 中設(shè)置的 “WordPress 地址 >(URL)”。該數(shù)據(jù)是從 wp_options 這個數(shù)據(jù)表中檢索到的 "siteurl" 記錄。 可以考慮使用 site_url() 來代替跃洛,尤其是在使用 子目錄路徑方式,而不是使用 子域名 來配置多站點時(bloginfo將返回根網(wǎng)站的URL蜜宪,而不是子站點的URL)虫埂。
- ‘siteurl’ / ‘url’ – 顯示在 設(shè)置 > 常規(guī) 中設(shè)置的 “站點地址(URL)”)”。該數(shù)據(jù)是從 wp_options 這個數(shù)據(jù)表中檢索到的 "home"記錄圃验。 可以考慮使用 home_url() 代替掉伏。
- ‘a(chǎn)dmin_email’ – 顯示在 設(shè)置 > 常規(guī) 中設(shè)置的 “電子郵件地址”。該數(shù)據(jù)是從 wp_options 這個數(shù)據(jù)表中檢索到的 >"admin_email"記錄澳窑。
- ‘charset’ – 顯示在 設(shè)置 > 常規(guī) 中設(shè)置的“頁面和feed的編碼”斧散。該數(shù)據(jù)是從 wp_options 這個數(shù)據(jù)表中檢索到的"blog_charset" 記錄。(注:3.5.1+好像已經(jīng)沒有這個選項了)
- ‘version’ – 顯示你當(dāng)前使用的 WordPress 版本摊聋。該數(shù)據(jù)是在 wp-includes/version.php 檢索到的 $wp_version 這個字段的值鸡捐。
- ‘html_type’ – 顯示W(wǎng)ordPress HTML 頁面中的內(nèi)容類型(默認(rèn): "text/html")。該數(shù)據(jù)可以從 wp_options 這個數(shù)據(jù)表中檢索到的 "html_type" 記錄麻裁。主題和插件可以通過使用 pre_option_html_type過濾器覆蓋默認(rèn)值箍镜。
- ‘text_direction’ – 顯示 WordPress HTML 頁面的文本方向〖逶矗可以考慮使用 is_rtl() 代替鹿寨。
- ‘language’ – 顯示W(wǎng)ordPress的語言。
- ‘stylesheet_url’ – 顯示當(dāng)前使用的主題的 CSS文件(通常為 style.css)路徑薪夕〗挪荩可以考慮使用 get_stylesheet_uri() 代替。
- ‘stylesheet_directory’ – 顯示當(dāng)前使用的主題的樣式表路徑原献×罂可以考慮使用 get_stylesheet_directory_uri() 代替。
- ‘template_url’ / ‘template_directory’ – 當(dāng)前主題的 URL 路徑 姑隅。在子主題中写隶, get_bloginfo(‘template_url’) 和 get_template() 都將返回父主題的目錄〗惭觯可以考慮使用 get_template_directory_uri() (用于父主題目錄)或get_stylesheet_directory_uri() (用于子主題目錄)代替慕趴。
- ‘pingback_url’ – 顯示通告文件 XML-RPC 的URL (xmlrpc.php)
- ‘a(chǎn)tom_url’ – 顯示 Atom feed URL (/feed/atom)
- ‘rdf_url’ – 顯示 RDF/RSS 1.0 feed URL (/feed/rfd).
- ‘rss_url’ – 顯示 RSS 0.92 feed URL (/feed/rss).
- ‘rss2_url’ – 顯示 RSS 2.0 feed URL (/feed).
- ‘comments_atom_url’ – 顯示評論的 Atom feed URL (/comments/feed).
- ‘comments_rss2_url’ – 顯示評論的 RSS 2.0 feed URL (/comments/feed).
獲取 options
表里面的數(shù)據(jù)
<? echo get_option("鍵名字"); ?>
本文參考文檔: