How to Create a WordPress template and WordPress template Technical Manual

Source: Internet
Author: User
Tags wordpress version
ArticleDirectory
    • A complete set of WordPress templates should have at least the following files:
A complete set of WordPress basic template files should have at least the following files:
    1. Style.css: CSS (style sheet) File
    2. Index. php: homepage Template
    3. Archive. php: Archive/Category Template
    4. 404. php: Not Found error page template
    5. Comments. php: Message/reply Template
    6. Footer. php: footer Template
    7. Header. php: Header Template
    8. Sidebar. php: sidebar Template
    9. Page. php: Content Page Template
    10. Single. php: Content Page (post) template
    11. Searchform. php: search form templates
    12. 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

    1. Is_home (): whether it is the Home Page
    2. Is_single (): whether it is a content page (post)
    3. Is_page (): whether it is a content page)
    4. Is_category (): whether it is a category/archive page
    5. Is_tag (): whether it is a tag archiving page
    6. Is_date (): whether to specify the date archive page
    7. Is_year (): Specifies whether the year is archived.
    8. Is_month (): Specifies whether the month is archived.
    9. Is_day (): Indicates whether to specify a day archive page.
    10. Is_time (): Specifies whether the time archive page is used.
    11. Is_archive (): whether it is an archive page
    12. Is_search (): whether it is a search result page
    13. Is_404 (): whether it is an "HTTP 404: Not Found" error page
    14. Is_paged (): whether the homepage/category/archive page is displayed in multiple pages

Common PHP Functions

    1. <? PHP bloginfo ('name');?> : Blog name (title)
    2. <? PHP bloginfo ('stylesheet _ url');?> : CSS file path
    3. <? PHP bloginfo ('pingback _ url');?> : Pingback URL
    4. <? PHP bloginfo ('template _ url');?> : Template File Path
    5. <? PHP bloginfo ('version');?> : Wordpress version
    6. <? PHP bloginfo ('Atom _ url');?> : Atom URL
    7. <? PHP bloginfo ('rss2 _ url');?> : RSS 2.o URL
    8. <? PHP bloginfo ('url');?> : Blog URL
    9. <? PHP bloginfo ('html _ type');?> : Blog webpage HTML type
    10. <? PHP bloginfo ('charset');?> : Blog webpage code
    11. <? PHP bloginfo ('description');?> : Blog description
    12. <? PHP wp_title ();?> : The title of a specific content page (post/Page)

Webpage TemplateCommon PHP functions and commands

  1. <? PHP get_header ();?> : Call HeaderTemplate
  2. <? PHP get_sidebar ();?> : Call the sidebar Template
  3. <? PHP get_footer ();?> : Call footer Template
  4. <? PHP the_content ();?> : Display content (post/Page)
  5. <? PHP if (have_posts ():?> : Check whether post/page exists
  6. <? PHP while (have_posts (): the_post ();?> : If post/page exists, it is displayed.
  7. <? PHP endwhile;?> : While ends
  8. <? PHP endif;?> : If ends
  9. <? PHP the_time ('string')?> : Display time. The time format is determined by the "string" parameter. For more information, see the PHP manual.
  10. <? 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.
  11. <? PHP the_title ();?> : Content Page (post/Page) Title
  12. <? PHP the_permalink ()?> : Content Page (post/Page) URL
  13. <? PHP the_category (',')?> : Category of a specific content page (post/Page)
  14. <? PHP the_author ();?> : Author
  15. <? PHP the_id ();?> : Specific content page (post/Page) ID
  16. <? PHP edit_post_link ();?> : If the user has logged on and has permissions, the edit link is displayed.
  17. <? PHP get_links_list ();?> : Display links in blogroll
  18. <? PHP comments_template ();?> : Call the message/reply Template
  19. <? PHP wp_list_pages ();?> : Display page list
  20. <? PHP wp_list_categories ();?> : Display the categories list
  21. <? PHP next_post_link ('% link');?> : Next article link
  22. <? PHP previus_post_link ('% link');?> : Link to the previous article
  23. <? PHP get_calendar ();?> : Calendar
  24. <? PHP wp_get_archives ()?> : Display content archival
  25. <? PHP posts_nav_link ();?> : Navigation, displaying the link of the previous or next article
  26. <? PHP Include (templatepath. '/filename');?> : Embed other files, which can be customizedWebsite templateOr other types of files

Other template-related functions

    1. : Output corresponding information
    2. : Display registration link
    3. : Display logon/Logout link
    4. : pagination of the current content
    5. : truncate the current content so that all content is not displayed on the homepage/directory page.
    6. : Webpage loading time (seconds)
    7. : Web page loading query volume

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.