dragunoff

wpquestions.com, ID = 3539

Dec 14th, 2011
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 KB | None | 0 0
  1. <?php
  2. /* Template name: Product Lines */
  3.  
  4. get_header();
  5.  
  6. // arguments
  7. $args = array(
  8.     'cache_images' => true,
  9.     'having_images' => false, // pull terms without images as well
  10.     'taxonomy' => 'product-line', // taxonomy
  11.     'term_args' => array( 'hide_empty' => 0 ) // args to get_terms()
  12. );
  13.  
  14. // query the terms
  15. $terms = apply_filters( 'taxonomy-images-get-terms', '',  );
  16.  
  17. // if there are any terms found
  18. if ( ! empty( $terms ) ) {
  19.  
  20.     // start concatenating output
  21.     $r = '<h1>Shop</h1>';
  22.    
  23.     // loop terms
  24.     foreach ( (array) $terms as $term ) {
  25.        
  26.         $term_href = esc_url ( get_term_link( $term->term_id, $term->taxononmy ) ); // term link
  27.        
  28.         $r .= '<div class="' . $term->slug . '">';
  29.             $r .= '<a href="' . $term_href . '">' . wp_get_attachment_image( $term->image_id, 'detail' ). '</a>'; // image with link
  30.             $r .= '<h2><a href="' . $term_href . '">' . $term->name . '</a></h2>'; // title with link
  31.             $r .= '<p>' . $term->description . '</p>'; // description
  32.         $r .= '</div><!-- /.' . $term->slug . ' -->';
  33.     }
  34.    
  35.     // print result
  36.     echo $r;
  37.    
  38. }
  39.  
  40. get_footer();
  41.  
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment