创建具有所有功能的wordpress文件
您好,我想创建一个文件,用我的产品生成定制的xml, 我在创建xml时没有问题, 但是我想连接到数据库并使用WP内置功能执行查询 我该怎么做?例如,我添加了这个文件buildXml.php 到项目文件夹创建具有所有功能的wordpress文件,wordpress,Wordpress,您好,我想创建一个文件,用我的产品生成定制的xml, 我在创建xml时没有问题, 但是我想连接到数据库并使用WP内置功能执行查询 我该怎么做?例如,我添加了这个文件buildXml.php 到项目文件夹 <?php //buildXml.php require(WORDPRESS_FUNCTIONALITY); // The Query query_posts( $args ); // The Loop while ( have_posts() ) : the_post();
<?php
//buildXml.php
require(WORDPRESS_FUNCTIONALITY);
// The Query
query_posts( $args );
// The Loop
while ( have_posts() ) : the_post();
echo 'stuff';
endwhile;
// Reset Query
wp_reset_query();
如果我理解正确,您应该能够调用wp load.php
(根据上的评论)