Home  >  Article  >  CMS Tutorial  >  How to add template page in wordpress

How to add template page in wordpress

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-07-12 10:46:264613browse

How to add template page in wordpress

How to create a new page template in WordPress?

The first step: Create a new empty file under the current theme, such as: page-member.php;

The second step: Copy the following code to the newly created file, Then save and transfer it to the server. At this point, the template page is created, and the text part can be freely used;

<?php 
/*
	template name: member
*/

get_header(); 

?>

正文部分

<?php get_footer(); ?>

Step 3: Log in to the backend - Page - Create a new page, and give it a name such as "Member Center". Then select the page template member (this name is the template name of the template file), as shown below. After saving, view the page, which is exactly what we created.

How to add template page in wordpress

Some tips for page templates:

You can fill in the word member that appears in this article freely, and it is recommended that it be in English;

Page Templates are PHP files, which means you can write dynamic scripts to get what you want, not just static code;

Page templates can be used on multiple pages, which is why they are called templates.

The above is the detailed content of How to add template page in wordpress. For more information, please follow other related articles on the PHP Chinese website!

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