Home  >  Article  >  Backend Development  >  The first basic understanding of WordPress development

The first basic understanding of WordPress development

WBOY
WBOYOriginal
2016-08-08 09:24:32869browse

Because it is the initial stage of WordPress development, we will start with the introduction of theme production first. I hope friends can download a theme or download a WordPress to compare and view, otherwise it will be extremely boring to just read the following introduction.

The first is the commonly used template files and uses of WordPress themes:

style.css is a style sheet file, which generally includes theme declarations and general css style codes

index.php is a homepage template, generally used Make the homepage of the website

header.php is the header template, which is generally the common part of the header of all pages

sidebar.php is the side template, which generally displays widgets

footer.php is the footer Templates generally place some "About Us", "Copyright Statement", etc., and may also have some statistical codes

archive.php is the archive and category template, used to display the article directory under the category

single. php is the content page template, which is the content of the post. Page.php is the content page template, which is the content of the page. Comments.php is the message and reply template. Searchform.php is the search form template. That is the search box we see

search.php is the search result template

404.php is the error page template

author.php is the article directory page, listing articles by a certain author

functions.php is a template function, which stores the function modules used by the theme

attachment.php is an attachment template page.

What needs to be explained here is that WordPress pictures or other uploaded files will be given an attachment ID. If you choose to link to the attachment page when inserting the picture, this template will not be included in the theme. An error will be reported.

Then there are some commonly used functions, listed here:

get_header() Call the header template

get_sidebar() Call the sidebar template

get_footer() Call the footer template

Among them bloginfo is a magical function, we can usually use it to get a lot of information

bloginfo('html_type') Web page html type

bloginfo('charset') Web page encoding

bloginfo('name' ) Blog name

bloginfo('url') Blog URL

bloginfo('description') Blog description

bloginfo('stylesheet_url') Path to css file

bloginfo('template_url' ) Path to the template file

The following are common display functions:

wp_head() Head hook function, basically used by every theme, because it is used to allow other plug-ins or functions to be displayed on the website The header outputs css or js files. If the theme does not have this function, it may cause many plug-ins to not work properly. Generally, we add it in header.php.

wp_footer() The bottom hook function is usually added in the footer.php file

wp_nav_menu() To call the navigation menu, you generally need to add the registration menu function register_nav_menus() in functions.php to use it together

wp_ list_bookmarks () Friendly link function

The following are some common judgment tags

is_home() Whether it is the homepage, the homepage uses index.php

is_front_page() Whether it is the specified homepage, if the homepage is not The default index.php, we need to use this to determine

By the way, we can specify the homepage

is_single() in the background--Settings---Reading whether it is a content page or a post

is_page() Whether it is a content page, it is a page

is_attachment() Whether it is an attachment page

is_singular() It can be understood as the synthesis of is_single()||is_page()||is_attachment()

is_category() Whether it is a category or archive page

is_tag() Whether it is a tag archive page

is_date() Whether it is archived on a specified date

 is_year()                                                              ‐ ’ s off ‐ ‐ ‐ ‐ ‐                                        using using         out out out's being'' ’ ‐   ‐ out out's ‐ ‐ ‐‐‐‐ ​ ​ ​                   across ) Is it a specified time? Archive page

is_archive() Is it an archive page? is_search() Is it a search results page? is_author() Is it an author archive page? _404() Is it an error page

is_paged() Whether the homepage/directory/archive page is displayed in multiple pages

is_user_logged_in() Whether the user is logged in

That’s it for the first article.

The above introduces the first basic understanding of WordPress development, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn