Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Template name: Product Lines */
- get_header();
- // arguments
- $args = array(
- 'cache_images' => true,
- 'having_images' => false, // pull terms without images as well
- 'taxonomy' => 'product-line', // taxonomy
- 'term_args' => array( 'hide_empty' => 0 ) // args to get_terms()
- );
- // query the terms
- $terms = apply_filters( 'taxonomy-images-get-terms', '', );
- // if there are any terms found
- if ( ! empty( $terms ) ) {
- // start concatenating output
- $r = '<h1>Shop</h1>';
- // loop terms
- foreach ( (array) $terms as $term ) {
- $term_href = esc_url ( get_term_link( $term->term_id, $term->taxononmy ) ); // term link
- $r .= '<div class="' . $term->slug . '">';
- $r .= '<a href="' . $term_href . '">' . wp_get_attachment_image( $term->image_id, 'detail' ). '</a>'; // image with link
- $r .= '<h2><a href="' . $term_href . '">' . $term->name . '</a></h2>'; // title with link
- $r .= '<p>' . $term->description . '</p>'; // description
- $r .= '</div><!-- /.' . $term->slug . ' -->';
- }
- // print result
- echo $r;
- }
- get_footer();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment