Created
May 24, 2015 22:36
-
-
Save Magnacarter/b9750c6a2866a638744e to your computer and use it in GitHub Desktop.
Single category page
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 | |
/* | |
* Single Categories | |
*/ | |
get_header() ?> | |
<section id="categories"> | |
<div class="gallery-categories grid-100"> | |
<ul> | |
<?php wp_list_categories( 'title_li=' ) ?> | |
</ul> | |
</div> | |
<div class="single-category-projects"> | |
<?php $category = get_category(get_query_var('cat') ); | |
$args = array( | |
'post_type' => 'portfolio', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'category', | |
'field' => 'slug', | |
'terms' => $category, | |
), | |
), | |
); | |
$projects = new WP_Query( $args ) ?> | |
<?php if ( $projects->have_posts() ) : ?> | |
<?php while ( $projects->have_posts() ) : $projects->the_post() ?> | |
<div class="single-work-wrap"> | |
<div class="single-work grid-33 tablet-grid-50 mobile-grid-100"> | |
<img src="<?php the_field( 'project_image' ) ?>" alt="<?php the_field( 'project_description' ) ?>"/></a> | |
<div class="gallery-hover grid-50"> | |
<a href="<?php echo esc_url( get_permalink() ) ?>"> | |
<h3><i><?php echo esc_html( get_the_title() ) ?></i></h3> | |
<h5><i><?php the_field( 'small_title' ) ?></i></h5> | |
</a> | |
</div> | |
</div> | |
</div> | |
<?php endwhile; endif; | |
wp_reset_postdata() ?> | |
</div> | |
</section> | |
<?php get_footer() ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, it was working the other way too, but I went ahead and did it your way. Thanks, man!