WordPress主题制作全过程(XI):制作page.php(wordpress主题divi)

Wordpress1年前 (2023)发布 SUYEONE
1.1K 0 0

In this article, we will delve into the creation of the `page.php` file in WordPress theme development, following the Series.on WordPress theme making. If you’re unfamiliar with the term “page,” it refers to indiVidual static pages like “About,” “Contact,” etc., which can be added and eDiTed through the WordPress backend under Pages. While blog posts are also considered pages, here we focus on standalone content.

The structure of `page.php` shares many similarities with `single.php`. We’ll skip some explanations and jump strAIght to the modifications for clarity. If needed, refer back to the WordPress theme making tutorial (Part 8: Creating `index.php`).

1. **Adding the Title:**
Replace the code:
“`htML

“`

2. **Inserting Page Content:**
Update with:
“`html

“`

3. **Including the Comment Box:**
Replace:
“`html

“`
With:
“`php

“`

4. **Adding the Query Statement:**
Modify:
“`html

“`
And change:
“`html

“`
To:
“`php

No page found!

“`

Now, our `page.php` is complete. Two additional pages, `full_width.php` (no sidebar) and `contact.php`, follow similar procedures. I’ve provided pre-written downloads for them. You might wonder how to use these pages. In each file, I’ve added comments:
“`php

“`
When creating new pages in WordPress, you can select a specific page template (Full Width or Contact) instead of the default `page.php`.

This concludes our WordPress theme-making tutorial series. Ideally, you’ve learned something valuable, even if my explanation wasn’t perfect. Think of it as an experiential journey through WordPress theme creation. The completed theme is available for download, though its aesthetics might not be appealing. Remember, the contact form’s sidebar can be customized with your own content.

For more information, explore other related articles on Host Reference.

© 版权声明

相关文章

暂无评论

暂无评论...
☺一键登录开启个人书签等功能!