Created
March 10, 2014 14:09
-
-
Save ahmadnaser/9465555 to your computer and use it in GitHub Desktop.
wordpress custom query 2
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
$eventsresult = $wpdb->get_results( "SELECT wp_posts.*, wp_term_taxonomy.taxonomy,wp_terms.`name`\n". | |
"FROM wp_posts, wp_term_taxonomy ,wp_terms,wp_term_relationships\n". | |
"WHERE \n". | |
" wp_term_taxonomy.term_taxonomy_id = wp_terms.term_id\n". | |
"and wp_term_relationships.object_id=wp_posts.ID\n". | |
"and wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id\n". | |
"and wp_terms.`name`='Movies'\n". | |
"and wp_posts.post_status = 'publish' \n". | |
"AND wp_posts.post_type = 'post';" ); | |
// print_r($eventsresult); | |
foreach($eventsresult as $post) | |
{ | |
echo get_the_post_thumbnail($post->ID)."<br />"; // without parameter -> Thumbnail | |
echo get_the_post_thumbnail($post->ID, 'thumbnail')."<br />"; // Thumbnail | |
echo get_the_post_thumbnail($post->ID, 'medium')."<br />"; // Medium resolution | |
echo get_the_post_thumbnail($post->ID, 'large')."<br />"; // Large resolution | |
echo get_the_post_thumbnail($post->ID, 'full')."<br />"; | |
echo "<li><a class='gift-text' href='#'>".$post->post_title."</a>"; | |
echo "<a href class='gift-text-author'>".$post->post_content."</a></li>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment