Created
July 15, 2011 18:55
-
-
Save ericpedia/1085282 to your computer and use it in GitHub Desktop.
How to change this foreach into a normal loop that can use, e.g., the_title()?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://wordpress.stackexchange.com/questions/23088/how-to-change-a-custom-query-into-a-standard-loop | |
$totalposts = $wpdb->get_results($querystr, OBJECT); | |
$wp_query->request = $querystr . " LIMIT " . $ppp . " OFFSET " .$offset; | |
$results = $wpdb->get_results($wp_query->request, OBJECT); | |
foreach ($results as $result) { /* instead of this I want something that would work like while ( $the_query->have_posts() ) : $the_query->the_post(); */ | |
$offset++; | |
$output .= '<a href="'.get_post_permalink($result->ID).'">' . $result->post_title . ' (' . $result->post_date . ')</a><br>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment