create file in a different location

2019-08-05 10:35发布

问题:

I want to with wordpress create a page in a different location of common wordpress posts and pages, like this: http://example.com/sitemap.xml and yet I want use WP Loop and all of wordpress functions please help me

回答1:

You should call "wp functions" at the beginning of your file using

header('Content-Type: text/html; charset: UTF-8');
require( '../../../../wp-load.php' );

where ../../ ... is the path to your wp-load.php file depending on where you put it.

After this, you can use loop the way you like.



标签: wordpress