Creating a custom page on wordpress and adding con

2019-03-04 00:10发布

问题:

I want to create a php page on the website (CMS Wordpress), but I do not understand how to incorporate the template files, for example

<?php get_header(); ?>

And other content. I know that it is possible to create pages through the admin interface, but I do not fit... if you try to create a page of template files and then go for it the direct link:

http://local/wp-content/themes/mytheme/mypage.php

with pre-embedding the code

<?php get_header(); ?>

it will fail like:

Fatal error: Call to undefined function get_header()

What should I do? How i can "say" this CMS that the page is important for me, and it performs some functionality? That is, in fact, get the full url to her and that did not give out errors…

回答1:

You need to include wp-load.php in your script to use any of WP functions:

<?
require_once('../../../wp-load.php');
get_header(); ?>

try that. xD