Created
October 22, 2014 16:19
-
-
Save indietravel/38ed27762fb844eee0a5 to your computer and use it in GitHub Desktop.
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
<div class="content-inner"> | |
<?php | |
if ( is_category() ) { | |
$cat = get_query_var('cat'); | |
$ourcat = get_category ($cat); | |
$category_selected = $ourcat->slug; | |
} | |
$args = array ( | |
'post_type' => 'story', | |
'post_status' => 'publish', | |
'posts_per_page' => '6', | |
'category_name' => $category_selected, | |
); | |
// The Query | |
$cat_query = new WP_Query( $args ); | |
?> | |
<?php if ( $cat_query -> have_posts() ) : ?> | |
<?php global $archive_i; $archive_i = 1 ?> | |
<?php while ( $cat_query -> have_posts() ) : $cat_query -> the_post(); ?> | |
<?php get_template_part('content', 'archive'); ?> | |
<?php $archive_i; ?> | |
<?php endwhile; ?> | |
<?php endif; | |
wp_reset_postdata(); // ADAPTED FOR CUSTOM POST TYPES | |
wp_reset_query(); | |
?> | |
</div> |
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 | |
// WP_Query arguments | |
$args = array ( | |
'post_type' => 'venue', | |
'post_status' => 'publish', | |
'pagination' => false, | |
'posts_per_page' => '3', | |
); | |
// The Query | |
$venue_query = new WP_Query( $args ); | |
// The Loop | |
if ( $venue_query->have_posts() ) { | |
while ( $venue_query->have_posts() ) { | |
$venue_query->the_post(); | |
the_title(); | |
} | |
} 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