Last active
August 29, 2015 14:13
-
-
Save nickkuijpers/3373ad72a79f3743c365 to your computer and use it in GitHub Desktop.
Wordpress: Get Custom Posts
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
<?php | |
$loop = new WP_Query( | |
array( | |
'post_type' => 'posts', | |
'posts_per_page' => 9999 | |
) | |
); | |
$i = 0; | |
while ( $loop->have_posts() ) : $loop->the_post(); | |
$i++; | |
$id = get_the_ID(); | |
?> | |
<?php | |
$terms = get_terms( 'type' ); | |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ | |
foreach ( $terms as $term ) { | |
?> | |
<?php echo sanitize_title($term->name); ?> | |
<?php echo $term->name; ?> | |
<?php | |
} | |
} | |
?> | |
<?php | |
$image = ''; | |
if (has_post_thumbnail()) { | |
$image = get_the_post_thumbnail($id,'large', array('class' => 'img-responsive')); | |
} | |
?> | |
<?php the_title(); ?> | |
<?php the_content(); ?> | |
<?php | |
endwhile; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment