[wp-hackers] Making use of The Loop in a shortcode function

Lox lox.dev at knc.nc
Wed Jun 23 14:41:30 UTC 2010


My code sample needs a fix. $post needs to be backed up to...

                global $wp_query, $post;
		
                $temp_query = clone $wp_query;
		$post_tmp 	= clone $post;
		
		$wp_query = new WP_Query($args') );
                setup_postdata($post);
		
		...

		$wp_query = clone $temp_query;
		$post = clone $post_tmp;
		
		setup_postdata($post);

-- 
Lox
lox.dev at knc.nc


More information about the wp-hackers mailing list