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();
Was it helpful?

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
scroll top