Created
April 29, 2016 00:19
-
-
Save jchristopher/8cf88e6d9aa2c72cf8b772ada1171e2f 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
<li id="camera-brands" class="widget-container"> | |
<h3 class="widget-title">Camera Brands</h3> | |
<?php $cam_brands = get_terms('brands', 'hide_empty=1'); ?> | |
<ul> | |
<?php foreach( $cam_brands as $brand ) : ?> | |
<li> | |
<a href="<?php echo get_term_link( $brand->slug, 'brands' ); ?>"> | |
<?php echo $brand->name; ?> | |
</a> | |
<ul> | |
<?php | |
$wpq = array( 'post_type' => 'cameras', 'taxonomy' => 'brands', 'term' => $brand->slug ); | |
$brand_posts = new WP_Query ($wpq); | |
?> | |
<?php foreach( $brand_posts->posts as $post ) : ?> | |
<li> | |
<a href="<?php echo get_permalink( $post->ID ); ?>"> | |
<?php echo $post->post_title; ?> | |
</a> | |
</li> | |
<?php endforeach ?> | |
</ul> | |
</li> | |
<?php endforeach ?> | |
</ul> | |
</li> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment