简体   繁体   English

如何制作WordPress自定义页面

[英]How to make Wordpress Custom page

ima newbie to wordpress. ima newbie to wordpress。 I have started theme development and encountered these problems. 我已经开始主题开发并遇到了这些问题。 I think these kind of problem does have a solution, but im not able to find it out. 我认为这类问题确实有解决方案,但我无法找出答案。

I m trying to make a custom page. 我正在尝试制作自定义页面。 Uptill now i have made header, footer and main index page. 到目前为止,我已经制作了页眉,页脚和主索引页面。 I see that whenever my theme is activated, I see these default index page, with header and footer assign to it. 我看到,只要激活了主题,就会看到这些默认的索引页,并为其分配了页眉和页脚。 I have also made some cutom about us , contact us pages using the Add Pages Functionality of wordpress. 我还对我们做了一些评论,请使用wordpress的“添加页面功能”与我们联系页面。

My Problem: 1.Now I m trying to make custom product page where I will have more than 100 images on that pages, and then i can change the images, add the images and description and the link url in future. 我的问题:1.现在,我试图制作自定义产品页面,在该页面上我将拥有超过100张图像,然后可以更改图像,添加图像和说明以及将来的链接URL。 I have made some html code and put it in the text Tab . 我做了一些html代码,并将其放在文本Tab中。 I can also see the images on the frontend of the Custom page. 我还可以在“自定义”页面的前端看到图像。 But my template breaks. 但是我的模板坏了。 Images goes up and description goes far below. 图像上升,说明远不及以下。

  1. Also i wanted to add fancybox to all the images which are goin to be replaced or added. 我也想将fancybox添加到所有要替换或添加的图像中。 But again my template breaks. 但是我的模板又一次损坏了。

So can we make custom.php page and do some coding or anything which you feel is the right way of doing it, Please let me know. 因此,我们可以制作custom.php页面并进行一些编码还是您认为正确的方法,请告诉我。

Firstly create product.php page in templates folder using below code on top 首先使用下面的代码在模板文件夹中创建product.php页面

<?php
/*
Template Name: My Product Page
*/

 get_header();
   // write your code here
 get_footer();

Then, assign the above template to the page in admin. 然后,将上述模板分配给admin页面。 Then, that page you can call in menu. 然后,您可以在菜单中调用该页面。 For more detail, check here :- http://codex.wordpress.org/Page_Templates 有关更多详细信息,请在此处检查: -http : //codex.wordpress.org/Page_Templates

Actually you don't really need to create a custom template for this unless if you are planing to use that same template on another page. 实际上,除非您打算在另一个页面上使用相同的模板,否则实际上并不需要为此创建自定义模板。

If your page name is products , just create a file called page-products.php in your theme root. 如果您的页面名称是products,只需在主题根目录中创建一个名为page-products.php的文件。 and write your code inside that page. 并在该页面中编写代码。

If your planing to develop themes first be comfirtable with wp template hierarchy. 如果您打算开发主题,那么首先要与wp模板层次结构兼容。 http://codex.wordpress.org/Template_Hierarchy http://codex.wordpress.org/Template_Hierarchy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Wordpress中制作自定义页面 - How to make a custom page in Wordpress 如何制作动态wordpress页面(自定义控件/页面模板框) - How to make a dynamic wordpress page (custom control/page template box) 如何在WordPress中制作自定义模板作为受密码保护的页面? - How to make a custom template in WordPress work as a password protected page? 如何在Wordpress 3.0中制作自定义帖子类型的页面? - How to make a page for Custom Post Types in Wordpress 3.0? 在拥有 WordPress 站点时,如何使自定义 php web 页面在 ZFDE316856817FE53586DZ 环境之外可见? - While having WordPress site, how do I make a custom php web page viewable outside the WordPress environment? 如何为自定义字段创建可排序的管理面板列,以计算Wordpress中的页面印象数 - How to make a sortable admin panel column for a custom field counting the number of page impressions in Wordpress 如何制作Wordpress自定义帖子类型固定链接 - How to make Wordpress Custom Post Type Permalink 如何为wordpress制作自定义图像调整大小命令? - How to make custom image resize command for wordpress? 如何在WordPress中为假人创建自定义帖子? - How to make custom posts in WordPress for a dummy? 如何制作以移动为中心的自定义 WordPress 页脚 - How to make custom WordPress footer centered on mobile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM