How can I save the HTML output of a WP_Query function as a variable?
The WP_Query class does not generate HTML markup. WP_Query will query the WordPress content, and provide some data back. So using WP_Query and the sprintf() PHP function, the HTML markup can be generated (untested): $args = array( … ); $query = new WP_Query( $args ); $html=””; while ( $query->have_posts() ) { $query->the_post(); $saved_html .= sprintf( … Read more