Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- remove_action( 'genesis_loop', 'genesis_do_loop' ); // Remove default Genesis Loop
- add_action( 'genesis_loop', 'child_cpt_post_loop' ); // Add custom post type loop
- /**
- * Build the custom loop to display project category
- *
- * @author Greg Rickaby
- * @since 1.0.0
- */
- function child_cpt_post_loop() {
- if ( is_category() ) {
- $cat = get_query_var( 'cat' );
- $cptcat = get_category($cat);
- $cptcat->slug;
- }
- $loop = new WP_Query( array(
- 'post_type' => 'project',
- 'posts_per_page' => 20,
- 'category_name' => $cptcat->slug,
- ) );
- while ( $loop->have_posts() ) : $loop->the_post(); ?>
- <div class="post-<?php the_ID(); ?> post project project-category">
- <div class="entry-content">
- <?php // Check for download link
- if ( genesis_get_custom_field( '_cmb_project_download' ) ) { ?>
- <div class="project-download">
- <a href="<?php echo genesis_get_custom_field( '_cmb_project_download' ); ?>" title="<?php the_title();?>" class="sfdl">
- <span>
- <b>Download</b>
- <small><?php the_title(); ?></small>
- </span>
- </a>
- </div>
- <?php } ?>
- <h1 class="entry-title">
- <?php // Check for icon
- if ( genesis_get_custom_field( '_cmb_project_icon' ) ) { ?>
- <div class="project-icon">
- <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>
- </div>
- <?php } ?>
- <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
- <?php // Check for short description
- if ( genesis_get_custom_field( '_cmb_project_short_description' ) ) { ?>
- <div class="project-short-description">
- <?php echo genesis_get_custom_field( '_cmb_project_short_description' ); ?>
- </div>
- <?php } ?>
- </div>
- <!-- end .entry-content -->
- </div>
- <!-- end .post -->
- <?php endwhile; wp_reset_query();
- }
- /** Finish loading the page */
- genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement