Categories

Featured templates

WordPress. How to create page templates

Norman Fisher March 31, 0204
Rating: 3.6/5. From 5 votes.
Please wait...

本教程将向您展示如何在WordPress中添加新的页面模板 Cherry Framework template.

WordPress. How to create page templates

  1. 登录你的WordPress管理面板.

  2. Go to  the Pages -> Add New 菜单以使用新页面模板创建新页面.

  3. 给你的新页面起一个标题并保存. In the Page Attributes 面板中,您可以从模板中已经包含的页面模板中选择一个页面模板. 你需要在这个列表中添加一个新的. 所有这些页面模板都位于 wp-content /主题/ CherryFramework folder on your FTP. 控件中添加一个新的页面模板 wp-content/themes/theme#####  folder on your FTP.

  4. Create a new  file in any .php editor 如Dreamweaver或notepad++,并给它起一个名字,e.g. new.php. 增加以下内容:

    
    
  5. 保存该文件并将其上传到 wp-content/themes/theme#####  folder on your FTP.

  6. 回到你在WordPress中创建的页面. In the Page Attributes 面板,你可以选择名为“Custom”的新页面模板.

    wordpress_cherry_new_page_template_adding_1

  7. Click Publish. Then click Preview Changes. 页面将完全空白.

  8. Go back to your new.PHP文件开始添加内容.  该文件可能包含您需要的任何内容,包括一些 static content 或者一些决定页面内容的标记.

  9. 中的其他页面模板中的元素也可以使用 wp-content /主题/ CherryFramework 文件夹以创建唯一的页面.

  10. Let’s first add a header and footer to it:

    
    
    
    
  11. 如果您保存更改,您可以在页面上看到它们:

    wordpress_cherry_new_page_template_adding_2

  12. 现在您需要决定希望在该页面上看到什么样的内容. 假设您没有“Our Team”自定义帖子的单独页面模板. And you really like the layout 的感言页面模板,并希望看到“团队”自定义帖子相同 layout. Under the Appearance -> Editor 菜单,您可以很容易地确定用于推荐页面模板的文件名称. It is page-testi.php.

    wordpress_cherry_new_page_template_adding_3

  13. Open this file to edit. 只复制内容部分,因为我们已经有 header and footer (这只是一个例子,所以你的代码可能会有所不同):

  14. Add the content to the new.php file. Rename: Template Name: Custom to Template Name: Team

  15. Change page-testi.php to new.php in the code.

  16. 该代码还包含对loop/loop-testi的引用.php file. 这是另一个需要复制的文件. Copy loop-testi.php from wp-content /主题/ CherryFramework /循环. And paste it to the # # # # # wp-content /主题/主题/循环 folder (if there is no loop  文件夹,你需要创建它). Rename the file to e.g. loop-new.php and open it for editing. Change the word “testi在这个文件的任何地方进行“团队”并保存更改. (你可以使用Control (Command) + F).

    wordpress_cherry_new_page_template_adding_4

  17. Since the loop-new.PHP创建和修改完成后,可以回到 new.php file and change loop/loop-testi.php to loop/loop-new.php in the code. 完成的代码看起来像这样:

    
    
  18. 保存更改并检查新页面. 它应该有团队自定义的职位上的感言 layout page.

    wordpress_cherry_new_page_template_adding_5

请随时查看下面的详细视频教程:

WordPress. How to create page templates

如果你想找一个专业的高级主题 website, take a look at design wordpress templates. Or check out a wide variety of WordPress templates page 为了更漂亮的设计.

Responsive Wordpress Themes
This entry was posted in WordPress, WordPress Tutorials and tagged Cherry, create, page, template, WordPress. Bookmark the permalink.

Submit a ticket

如果您仍然无法找到关于您的问题的足够的教程,请使用以下链接向我们的技术支持团队提交请求. 我们将在接下来的24小时内为您提供我们的帮助和协助: Submit a ticket