我在wordpress网站上使用角度来生成动画页面过渡。角度HTML代码由PHP在wordpress自定义模板中生成,我已设置角度以获取单个php文件。
当通过angular获取php文件时,基本的php代码执行得很好。但是,找不到与wordpress相关的任何内容。我猜是因为wordpress php文件已在初始页面加载时执行过。
我在php文件中使用了require并给出了我正在使用的一些文件的路径,但是他们仍然需要wordpress php文件才能运行,所以他们抛出500 (Internal Server Error)
<div id="pageone">
<p>This is page 1.</p>
<a href="#page2">Go to page 2 </a><br>
<?php
echo ('this php line works');
require './../../lib/custom.php';
echo ('this file is found, but needs wordpress functions, so throws 500 error');
?>
</div>
我想我可以使用require来获取核心wordpress php文件,但我不知道是哪个php文件..
答案 0 :(得分:0)
对于任何想知道的人来说,wordpress的核心php文件(无论如何为root主题)位于
幅/ WP / WP-load.php
require './../../../../../wp/wp-load.php';
来自wp-load的模糊
/**
* Bootstrap file for setting the ABSPATH constant
* and loading the wp-config.php file. The wp-config.php
* file will then load the wp-settings.php file, which
* will then set up the WordPress environment.
*
* If the wp-config.php file is not found then an error
* will be displayed asking the visitor to set up the
* wp-config.php file.
*
* Will also search for wp-config.php in WordPress' parent
* directory to allow the WordPress directory to remain
* untouched.
*
* @internal This file must be parsable by PHP4.
*
* @package WordPress
*/