Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // set up taxonomies
- $tax_one = 'service_categories';
- $post_type = 'services';
- $categories = get_categories( array(
- 'post_type' => $post_type,
- 'orderby' => 'name',
- 'order' => 'ASC',
- 'hide_empty' => 1,
- 'hierarchical' => 1,
- 'taxonomy' => $tax_one ));
- foreach ( $categories as $category ) : // list all categories
- echo '<h2><a href="'.get_term_link( $category->slug, $tax_one ).'">'.$category->name.'</a></h2>'?>
- <?php
- $args['tax_query'] = array(
- array(
- 'taxonomy' => $tax_one,
- 'terms' => array($category->slug),
- 'field' => 'slug'
- ),
- );
- $loop = new WP_Query( $args );
- if ( $loop->have_posts() ) :
- ?>
- ...loop stuff here
- <?php endif; ?>
- <?php endforeach; ?>
Add Comment
Please, Sign In to add comment