Skip to content

Instantly share code, notes, and snippets.

@yeltsin
Created July 10, 2014 07:13
Show Gist options
  • Save yeltsin/95fe4c4753d17bfbd965 to your computer and use it in GitHub Desktop.
Save yeltsin/95fe4c4753d17bfbd965 to your computer and use it in GitHub Desktop.
<?php
// WP_Query arguments
$args = array (
'post_type' => 'tipodopost',
'category_name' => 'slugdacategoria',
'posts_per_page' => '-1',
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
?>
<a href="<?php the_permalink(); ?>"<?php the_thumbnail(); ?>
<?php the_title(); ?></a>
<?php
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment