WordPress is currently the world's most widely used blog system, is an open source of PHP software. Because the user is numerous, so the WordPress community is very active, has the rich plug-in template resources. Use WordPress can quickly build independent blog site. Many well-known science and technology blog is also built by WordPress, such as: Lei Feng nets, titanium media. The following PHP site for WordPress Theme developers sorted out the necessary knowledge to make WordPress theme.
wordpress Theme Template Hierarchy
Home:
- home.php
- index.php
article page:
- single-{post_type}.php– if the article type is videos (ie video), WordPress will go to find single-videos.php (WordPress 3.0 and above version support)
- single.php
- index.php
page:
- Custom template – Where the page is created in WordPress background, the right-hand sidebar can select a custom template for the page
- page-{slug}.php– if the page's thumbnail name is news,wordpress will look for page-news.php (WordPress 2.9 and above version support)
- page-{id}.php– If the page ID is 6,wordpress will look for page-6.php
- page.php
- index.php
Category:
- category-{slug}.php– if the abbreviated name of the category is news,wordpress will look for category-news.php (WordPress 2.9 and above version support)
- category-{id}.php-If the category ID is 6,wordpress will look for category-6.php
- category.php
- archive.php
- index.php
label
- tag-{slug}.php– if the label name is Sometag,wordpress, it will look for tag-sometag.php
- tag-{id}.php– If the label ID is 6,wordpress will look for tag-6.php (WordPress 2.9 and above version support)
- tag.php
- archive.php
- index.php
Author:
- author-{nicename}.php– If the author's nickname is Rami,wordpress will look for author-rami.php (WordPress 3.0 and above version support)
- author-{id}.php– If the author ID is 6,wordpress will look for author-6.php (WordPress 3.0 and above version support)
- author.php
- archive.php
- index.php
Date page:
- date.php
- archive.php
- index.php
Search Results:
- search.php
- index.php
404 (Not found) page
- 404.php
- index.php
Attachment page:
- mime_type.php– can be any MIME type (image.php, video.php, audio.php, application.php, or others).
- attachment.php
- single.php
- index.php
WordPress Theme – Judge Tag
Is_home (): Is the home page
Is_single (): Is a content page (Post)
Is_page (): Is the Content page (page)
Is_category (): Is category/archive page
Is_tag (): Is the Tag archive page
Is_date (): archive page for specified date
Is_year (): Archive page for a specified year
Is_month (): Whether to archive pages for a specified month
Is_day (): Archive page for the specified day
Is_time (): archive page for specified time
Is_archive (): Is an archive page
Is_search (): Is the search results page
Is_404 (): Is an "HTTP 404:not Found" error page
Is_paged (): Homepage/category/archive page is displayed on multiple pages
Judge tag is often used in WordPress theme sidebar (sidebar.php) template file
WordPress Theme –header 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 page HTML type
<?php bloginfo (' CharSet ');?>: Blog page encoding
<?php bloginfo (' description ');?>: Blog description
<?php wp_title ();?>: Title of a specific content page (Post/page)
WordPress Theme – templates commonly used PHP functions
<?php Get_header ();?>: Calling Header Template
<?php Get_sidebar ();?>: Calling sidebar template
<?php Get_footer ();?>: Calling footer Template
<?php the_content ();?>: Display content (Post/page)
<?php if (have_posts ())?>: Check for presence Post/page
<?php while (have_posts ()) "The_post ()?>: Display if there is post/page
<?php endwhile?>: While end
<?php endif?>: If End
<?php the_time (' string ')?>: Display time, time format is determined by "string" parameter, specific reference PHP manual
<?php Comments_popup_link ();?>: Message link in the body. If you use Comments_popup_script (), the message opens in a new window and, conversely, opens in the current window
<?php the_title ();?>: Content page (post/page) title
<?php The_permalink ()?>: Content page (post/page) Url
<?php the_category (', ')?>: A specific content page (Post/page) belongs to category
<?php The_author ();?>: Author
<?php the_id ();?>: Specific content page (post/page) ID
<?php Edit_post_link ()?>: If the user is logged in and has permission to display the edit link
<?php get_links_list ();?>: displaying links in Blogroll
<?php comments_template ();?>: Calling message/reply template
<?php wp_list_pages ();?>: Show Page List
<?php wp_list_categories ();?>: Display Categories list
<?php next_post_link ('%link ');?>: Next article link
<?php previous_post_link ('%link ');?>: previous article link
<?php Get_calendar ();?>: Calendar
<?php wp_get_archives ()?>: Display content Archive
<?php Posts_nav_link ();?>: navigation, displaying previous/next post links
<?php include (TemplatePath. '/filename ');?>: Embed other files, can be customized templates or other types of files
WordPress Theme – Other functions related to templates
<?php _e (' message ');?>: output appropriate information
<?php Wp_register ();?>: Show Registered Links
<?php wp_loginout ();?>: Show Logon/Logoff links
<!–next page->: Paging the current content
<!–more–>: Truncate the current content to not display all content on the home page/catalog pages
<?php timer_stop (1);?>: Web Load Time (sec)
<?php Echo get_num_queries (): Page load Query volume
Reprint please indicate the source: http://www.php-z.com/753.html