Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active December 28, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robneu/7440551 to your computer and use it in GitHub Desktop.
Save robneu/7440551 to your computer and use it in GitHub Desktop.
<?php
/**
* Template Name: FitFluential Finds Archives
* Description: This is a page template to show the FitFluential Finds CPT
*
* @package FitFluential
* @subpackage Genesis
* @copyright Copyright (c) 2013, WP SIte Care, LLC
* @license GPL-2.0+
* @since 1.0.0
*/
// Remove Post Info.
remove_action('genesis_before_post_content','genesis_post_info');
// Remove the Post Meta.
remove_action('genesis_after_post_content','genesis_post_meta');
add_action( 'genesis_entry_content', 'fff_do_finds_loop' );
/**
* Add FitFluential Finds loop within the default Genesis loop.
*
* This will add a custom loop which displays the FitFluential Finds CPT
* after the default page content added by a user via the WP Editor.
*
* @since 1.0.0
*/
function fff_do_finds_loop() {
// Enable pagination
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
// Setup the custom loop args.
$args = array(
'post_type' => 'fitflu_finds',
'posts_per_page' => '18',
'paged' => $paged,
);
// Use "the Loop" to retrieve the "Finds"
$finds = new WP_Query( $args );
// Display the "finds"
echo'<div class="fit-finds">';
if ( $finds->have_posts() ) :
while ( $finds->have_posts() ) : $finds->the_post();
echo '<div class="fitflu-finds-grid-item one-third">';
echo '<div class="fitflu-finds-grid-image">' . '<a href="' . get_permalink() .'"><img src="' . get_post_meta(get_the_id(), "fitfluentialfinds_product_image", true) . '"/></a></div>';
// echo '<div class="fitflu-finds-grid-product-title"><a href="' . get_permalink() .'">'. get_the_title() . '</a></div>';
// echo '<div class="fitflu-finds-vendor">by ' . get_post_meta(get_the_id(), 'fitfluentialfinds_product_vendor', true) . '</div>'; //retrieve custom field
echo '</div>';
endwhile;
endif;
wp_reset_postdata();
echo'</div><!--/ .fit-finds-->';
// Include Pagination
genesis_posts_nav();
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment