From: http://www.xincss.com /? P = 55
WordPress Basic Template File
A complete set of WordPress templates should have at least the following files:
style.css
: CSS (style sheet) File
index.php
: Homepage Template
archive.php
: Archive/Category Template
404.php
: Not Found error page template
comments.php
: Message/reply Template
footer.php
: Footer Template
header.php
: Header Template
sidebar.php
: Sidebar Template
page.php
: Content Page Template
single.php
: Content Page (post) template
searchform.php
: Search form templates
search.php
: Search result Template
Of course, specific to a specific template may not be more than these files, but in general, these files are essential for each template.
Tag of basic condition judgment
is_home()
: Whether it is the Home Page
is_single()
: Whether it is a content page (post)
is_page()
: Whether it is a content page)
is_category()
: Whether it is a category/archive page
is_tag()
: Whether it is a tag archiving page
is_date()
: Whether to specify a date archive page
is_year()
: Indicates whether the archive page is for a specified year.
is_month()
: Whether to specify the month archive page
is_day()
: Whether to specify a daily archive page
is_time()
: Whether the specified time archive page is used
is_archive()
: Whether it is an archive page
is_search()
: Whether it is a search result page
is_404()
: Whether it is an "HTTP 404: Not Found" error page
is_paged()
: Whether the homepage/category/archive page is displayed in multiple pages
Common PHP Functions
- <? PHP bloginfo ('name');?> : Blog name (title)
- <? PHP bloginfo ('stylesheet _ url');?> : CSS file path
- <? PHP bloginfo ('pingback _ url');?> : Pingback URL
- <? PHP bloginfo ('template _ url');?> : Template File Path
- <? PHP bloginfo ('version');?> : Wordpress version
- <? PHP bloginfo ('Atom _ url');?> : Atom URL
- <? PHP bloginfo ('rss2 _ url');?> : RSS 2.o URL
- <? PHP bloginfo ('url');?> : Blog URL
- <? PHP bloginfo ('html _ type');?> : Blog webpage HTML type
- <? PHP bloginfo ('charset');?> : Blog webpage code
- <? PHP bloginfo ('description');?> : Blog description
- <? PHP wp_title ();?> : The title of a specific content page (post/Page)
Common PHP functions and commands for templates
- <? PHP get_header ();?> : Call the header Template
- <? PHP get_sidebar ();?> : Call the sidebar Template
- <? PHP get_footer ();?> : Call footer Template
- <? PHP the_content ();?> : Display content (post/Page)
- <? PHP if (have_posts ():?> : Check whether post/page exists
- <? PHP while (have_posts (): the_post ();?> : If post/page exists, it is displayed.
- <? PHP endwhile;?> : While ends
- <? PHP endif;?> : If ends
- <? PHP the_time ('string')?> : Display time. The time format is determined by the "string" parameter. For more information, see the PHP manual.
- <? PHP comments_popup_link () ;?> : Message link in the body. If comments_popup_script () is used, the message is displayed in the new window. Otherwise, the message is displayed in the current window.
- <? PHP the_title ();?> : Content Page (post/Page) Title
- <? PHP the_permalink ()?> : Content Page (post/Page) URL
- <? PHP the_category (',')?> : Category of a specific content page (post/Page)
- <? PHP the_author ();?> : Author
- <? PHP the_id ();?> : Specific content page (post/Page) ID
- <? PHP edit_post_link ();?> : If the user has logged on and has permissions, the edit link is displayed.
- <? PHP get_links_list ();?> : Display links in blogroll
- <? PHP comments_template ();?> : Call the message/reply Template
- <? PHP wp_list_pages ();?> : Display page list
- <? PHP wp_list_categories ();?> : Display the categories list
- <? PHP next_post_link ('% link');?> : Next article link
- <? PHP previus_post_link ('% link');?> : Link to the previous article
- <? PHP get_calendar ();?> : Calendar
- <? PHP wp_get_archives ()?> : Display content archival
- <? PHP posts_nav_link ();?> : Navigation, displaying the link of the previous or next article
- <? PHP Include (templatepath. '/filename');?> : Embed other files, which can be customized templates or other types of files
Other template-related functions
- <? PHP _ E ('message');?> : Output corresponding information
- <? PHP wp_register ();?> : Display registration Link
- <? PHP wp_loginout ();?> : Display logon/logout links
- <! -Next page->: pagination of the current content
- <! -More->: truncate the current content so that all content is not displayed on the homepage/directory page.
- <? PHP timer_stop (1);?> : Webpage loading time (seconds)
- <? PHP echo get_num_queries ();?> : Number of web page loading queries
Of course, these are the most basic things related to the template. For more details, see the official WordPress documentation.