doubi3996 2015-01-13 01:24
浏览 33
已采纳

需要在WordPress上创建新的自定义页面

I'm trying to create a web that have a main page, and another four sections that I want to use the same template. I've copied the 'index.php' in the theme's folder as 'index_wealth.php' and when I use a link to it I'm getting:

Fatal error: Call to undefined function get_header() in C:\xampp\apps\wordpress\htdocs\wp-content\themesestimpo\index_wealth.php on line 7

My page starts this way:

<?php
/**
 * The main template file.
 * @package RestImpo
 * @since RestImpo 1.0.0
*/
get_header(); ?>

I have to replicate the main page four times, and the header is the same in everyone, how can I do this?

Tried this but I'm just getting more errors:

require_once('C:\xampp\apps\wordpress\htdocs\wp-includes\template.php');
require_once('C:\xampp\apps\wordpress\htdocs\wp-includes\plugin.php');
require_once('C:\xampp\apps\wordpress\htdocs\wp-includes\general-template.php');
get_header();

Thanks for help!

  • 写回答

2条回答 默认 最新

  • duaiwo9093 2015-01-13 01:56
    关注

    To do this you need to prepare two page templates. One is for main page and one for the pages with same layout.

    Just modify the upper content of your index_wealth.php like this :

    <?php
    /*
    Template Name: Main Page Template
    */
    get_header(); ?>
    

    After this Go to admin => Pages( Edit the Page you want to set as main page) => Select Main Page template and then update.

    In the same way, prepare a separate common template for other pages with same layout and apply it to them.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部