Advertisement
gregrickaby

taxonomy.php

Feb 2nd, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.99 KB | None | 0 0
  1. <?php
  2.  
  3. remove_action( 'genesis_loop', 'genesis_do_loop' ); // Remove default Genesis Loop
  4. add_action( 'genesis_loop', 'child_cpt_post_loop' ); // Add custom post type loop
  5. /**
  6.  * Build the custom loop to display project category
  7.  *
  8.  * @author Greg Rickaby
  9.  * @since 1.0.0
  10.  */
  11. function child_cpt_post_loop() {
  12.  
  13.     $term = get_query_var( 'term' );
  14.     $taxonomy = get_query_var( 'project' );
  15.  
  16.     $loop = new WP_Query( array( $taxonomy => $term ) );
  17.  
  18.     while ( $loop->have_posts() ) : $loop->the_post(); ?>
  19.                 <div class="post-<?php the_ID(); ?> project project-category">
  20.                     <div class="entry-content">
  21.                     <?php // Check for download link
  22.                         if ( genesis_get_custom_field( '_cmb_project_download' ) ) { ?>
  23.                     <div class="project-download">
  24.                         <a href="<?php echo genesis_get_custom_field( '_cmb_project_download' ); ?>" title="<?php the_title();?>" class="sfdl">
  25.                             <span>
  26.                                 <b>Download</b>
  27.                                 <small><?php the_title(); ?></small>
  28.                             </span>
  29.                         </a>
  30.                     </div>
  31.                     <?php } ?>
  32.  
  33.                     <h1 class="entry-title">
  34.                     <?php // Check for icon
  35.                         if ( genesis_get_custom_field( '_cmb_project_icon' ) ) { ?>
  36.                     <div class="project-icon">
  37.                             <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo genesis_get_custom_field( '_cmb_project_icon' ); ?>" title="<?php the_title();?>" alt="<?php the_title();?>" height="48" width="48" class="the-icon" /></a>
  38.                     </div>
  39.                     <?php } ?>
  40.                         <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
  41.  
  42.                     <?php // Check for short description
  43.                         if ( genesis_get_custom_field( '_cmb_project_short_description' ) ) { ?>
  44.                             <div class="project-short-description">
  45.                                 <?php echo genesis_get_custom_field( '_cmb_project_short_description' ); ?>
  46.                             </div>
  47.                     <?php } ?>
  48.                     </div>
  49.                     <!-- end .entry-content -->
  50.                 </div>
  51.                 <!-- end .post -->
  52.     <?php endwhile; wp_reset_query();
  53. }
  54.  
  55. /** Finish loading the page */
  56. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement