WordPress模版标签
一个模板标签是一段代码用来指定WordPress去“做”或者“获取”某事或某物。在header.php显示Blog名称地方,WordPress使用了下面代码:
<h1><?php bloginfo('name'); ?></h1>
此模板标签是<?php bloginfo(); ?>外包含HTML标题标签h1。bloginfo()标签向你的用户资料获取Blog的信息。 在这个例子里,引号里面的name 告诉WordPress“获取Blog的站点名字”,它是一参数.
模板标签参数
- 名称<?php bloginfo(’name’); ?>
上面已经提到,用来显示Blog站点名称
- 描述<?php bloginfo(’description’); ?>
显示站点描述
- 网址<?php bloginfo(’url’); ?>
显示Blog地址
- 管理员邮件地址<?php bloginfo(’admin_email’); ?>
如果想显示邮件地址,不需要直接修改模板文件直接显示,只需要加入前面这段代码即可。这方便随时修改邮件地址。
- 版本<?php bloginfo(’version’); ?>
显示所使用的WordPress版本号,通常放在站点页脚上。
想要显示WordPress版本信息,可以使用下面这段代码:
<p>Powered by WordPress version <?php bloginfo('version'); ?></p>
想学习更多关于模板标签的内容,请参考TemplateTags
标签列表
作者 tags
- the_author
- the_author_description
- the_author_login
- the_author_firstname
- the_author_lastname
- the_author_nickname
- the_author_ID
- the_author_email
- the_author_url
- the_author_icq
- the_author_aim
- the_author_yim
- the_author_msn
- the_author_posts
- the_author_posts_link
- list_authors
- wp_list_authors
目录tags
- the_category
- the_category_rss
- the_category_ID (Deprecated)
- the_category_head (Deprecated)
- single_cat_title
- category_description
- dropdown_cats
- list_cats
- wp_list_cats
- in_category
- get_category_parents
- get_the_category
评论tags
- comments_number
- comments_link
- comments_rss_link
- comments_popup_script
- comments_popup_link
- comment_ID
- comment_author
- comment_author_IP
- comment_author_email
- comment_author_url
- comment_author_email_link
- comment_author_url_link
- comment_author_link
- comment_type
- comment_text
- comment_excerpt
- comment_date
- comment_time
- comment_author_rss
- comment_text_rss
- comment_link_rss
- permalink_comments_rss
日期和时间tags
- the_date_xml
- the_date
- the_time
- get_the_time (1.5 +)
- single_month_title
- the_weekday (Deprecated)
- the_weekday_date (Deprecated)
一般tags
- bloginfo
- bloginfo_rss
- get_bloginfo
- get_bloginfo_rss
- wp_title
- get_archives
- wp_get_archives
- get_calendar
- get_posts
- wp_list_pages (1.5+)
- wp_loginout (1.5+)
- wp_register (1.5+)
- query_posts (1.5+)
- rss_enclosure (1.5+)
Geo tags
Geo 功能在Wordpress 1.5中转移到一个插件来实现。
- print_Lat (the_Lat)
- print_Lon (the_Lon)
- print_UrlPopNav (the_UrlPopNav)
- print_AcmeMap_Url (the_AcmeMap_Url)
- print_GeoURL_Url (the_GeoURL_Url)
- print_GeoCache_Url (the_GeoCache_Url)
- print_MapQuest_Url (the_MapQuest_Url)
- print_SideBit_Url (the_SideBit_Url)
- print_DegreeConfluence_Url (the_DegreeConfluence_Url)
- print_TopoZone_Url (the_TopoZone_Url)
- print_FindU_Url (the_FindU_Url)
- print_MapTech_Url (the_MapTech_Url
链接tags
- edit_post_link
- edit_comment_link
- link_pages
- wp_link_pages
- get_year_link
- get_month_link
- get_day_link
链接管理tags
- get_links_list
- wp_get_links
- get_links
- wp_get_linksbyname
- get_linksbyname
Permalink tags
- permalink_anchor
- get_permalink
- the_permalink
- permalink_single_rss
发帖tags
- the_ID
- the_title
- single_post_title
- the_title_rss
- the_content
- the_content_rss
- the_excerpt
- the_excerpt_rss
- previous_post
- next_post
- posts_nav_link
- the_meta
Trackback tags
- trackback_url
- trackback_rdf
3条评论 ▼