Understanding some of the above basic tags and PHP code can greatly help you modify WordPress. we suggest you back up this article and use it later for reference. Of course, if you are an HTML veteran, a DVI + CSS master, or a PHP holy hand, you do not have to do this!
For many new WordPress users, if they do not understand any code, they will blindly change the WordPress theme, and the effects may often be something like a syntax error or unsatisfactory. If you want to modify the WordPress theme template file, you must understand the HTML code and the DIV + CSS layout. you must also understand the PHP code.
But some simple and easy-to-understand code and functions are not difficult to learn. you will remember it when you change it more, at the same time, these basic codes and functions are especially important for a new user who is interested in modifying a WordPress theme template, new users who focus on website content can read this article with a learning attitude.
Most of the domestic WordPress themes are modified in some early Chinese themes, and many friends like Chinese themes. Of course, modifying these themes is inseparable from some of the basic code and functions I mentioned above. Therefore, Yi Hengan specially searched for some basic code and functions that are frequently encountered in WordPress theme template files, share this with you.
WordPress topic-basic template file
A complete set of WordPress themes should have at least the following template 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, it refers to a WordPress theme (the English theme has now evolved into a more diversified theme element). These files may not be more than these files, but in general, these files are essential for each WordPress theme.
WordPress topic-Tag Determination
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 the date archive page
Is_year (): specifies whether the year is archived.
Is_month (): specifies whether the month is archived.
Is_day (): indicates whether to specify a day archive page.
Is_time (): specifies whether the 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
The above judgment Tag is often applied to the sidebay template file in the WordPress topic, such as is_home (). For example, you put an advertisement code on the sidebar, however, if you only want to display this advertisement on the homepage, you can use this Tag.
WordPress topic-common Header PHP functions
: Blog name (Title)
: CSS file path
: PingBack Url
: Template file path
: WordPress version
: Atom Url
: RSS 2.o Url
: Blog Url
: Blog webpage Html type
: Blog webpage code
: Blog description
: The title of a specific content Page (Post/Page)
WordPress theme-common PHP functions in templates
: Call the Header template
: Call the Sidebar template
: Call Footer template
: Display Content (Post/Page)
: Check whether Post/Page exists
: If Post/Page exists, it is displayed.
: While ends
: If ends
: Display time. the time format is determined by the "string" parameter. For more information, see The PHP Manual.
: 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.
: Content Page (Post/Page) title
: Content Page (Post/Page) Url
: Category of a specific content Page (Post/Page)
: Author
: Specific content Page (Post/Page) ID
: If the user has logged on and has permissions, the edit link is displayed.
: Display links in Blogroll
: Call the message/reply template
: Display Page List
: Display the Categories list
: Next article link
: Link to the previous article
: Calendar
: Display content archival
: Navigation, displaying the link of the previous or next article
: Embed other files, which can be customized templates or other types of files
WordPress topic-other template-related functions
: Output corresponding information
: Display registration link
: Display logon/logout links
: Pagination of the current content
: Truncate the current content so that all content is not displayed on the home page/directory page.
: Webpage loading time (seconds)
: Number of web page loading queries
Understanding some of the above basic tags and PHP code can greatly help you modify WordPress. we suggest you back up this article and use it later for reference. Of course, if you are an HTML veteran, a DVI + CSS master, or a PHP holy hand, you do not have to do this!