Custom WordPress page method

Source: Internet
Author: User
Tags php template

If you have customized or designed a WordPress topic, you may encounter the following problems:

How can we make WordPress pages have different la S or styles?

By default, WordPress uses page. php to process the appearance of all pages. However, WordPress provides a page template mechanism for WordPress developers to customize the appearance and layout of each WordPress page.

Use WordPress page template
Let's take a simple example. For example, all the pages in your blog have a sidebar, and on the "About" page, the width of the content you want can be expanded to the width of the page.

The detailed implementation steps are as follows:

Create a new template in the currently used topic folder and name it about. php.
Copy the content in the page. php template to the about. php file.
Next, find the sidebar function called in the template file, and remove or comment out it.
You may need to find the content div tag and manually add a width style to it to expand the width so that the entire container div tag can be fully occupied.
After completion, insert the following code at the top of about. php:

The code is as follows: Copy code
<? Php
/*
Template Name: About
*/
?>

Save the modification and upload it to the current topic folder on the server.

Then let the "about" page use the "about" page template, log on to the WordPress background, create a new page, or edit the about page (if it has already been created), on the right, click the drop-down menu of the page template, find "about" in the drop-down list, select it, and click save.

In this way, the layout of the "About" page is different from that of other pages.

Using WordPress page templates is a very common technique, especially for users who use WordPress as a CMS. With your imagination, you can use it to create very creative pages.

 

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.