zouleo 1 Report post Posted October 19, 2012 Basically I have a sql query that selects about 50 posts from the database based on certain criteria. What I'm wonder is if it is possible to display all these posts on a page using the default template for post the post loop. What I have done so far is to make a plugin that inserts the list in any post based on a shortcode [myspecialposts]. And then I do a sql query to fetch the posts. But how do I display each post using the default themplate? This is my code: function myspecialposts_func( $atts ) { global $wpdb; global $post; $sql = "SELECT {$wpdb->posts}.* ..."; $myposts = $wpdb->get_results($sql, OBJECT); foreach ($myposts as $post) : setup_postdata($post); // display each post using default template. HOW? endforeach; add_shortcode( 'myspecialposts', 'myspecialposts_func' ); Basically I want to use the get_article() function in the PageLinesPosts class. Is that possible? Please help. Share this post Link to post Share on other sites
Danny+ 1,327 Report post Posted October 19, 2012 HI, I think the best course of action would be to create a custom loop section based on the Postloop section and add your criteria to the code. Please search our forums, before posting! Share this post Link to post Share on other sites
zouleo 1 Report post Posted October 21, 2012 Thanks for the suggestion. But the postloop section is almost empty: $theposts = new PageLinesPosts(); $theposts->load_loop(); Would it be possible to insert that code after my code? Like this: $myposts = $wpdb->get_results($sql, OBJECT); $theposts = new PageLinesPosts(); $theposts->load_loop(); Or exactly what are you suggesting? Share this post Link to post Share on other sites
Danny+ 1,327 Report post Posted October 21, 2012 Well PHP isn't my forte. Therefore, I recommend if you need further assistance, you contact one of our Pros - http://www.pagelines.com/pros/ Please search our forums, before posting! Share this post Link to post Share on other sites