create a wordpress file with all functionality
-
23-12-2019 - |
Question
hello I would like to create a file that will generate a customized xml with my products, I have no problems creating the xml, but I want to connect to the db and perform a query using the WP built in functionality.
How do I do that? for example I add this file buildXml.php to the project folder.
<?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();
Solution
If I've understood you correctly, you should be able to call wp-load.php
(as per the comment on this answer).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow