-
-
Save robneu/5152371 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Name: Testimonial Archives | |
* Description: Used as a page template to show page contents, followed by a | |
* loop through a CPT archive | |
*/ | |
/** Remove Post Info */ | |
remove_action('genesis_before_post_content','genesis_post_info'); | |
/** Remove Post Meta */ | |
remove_action('genesis_after_post_content','genesis_post_meta'); | |
/** Output Testimonial Content Loop */ | |
add_action( 'genesis_after_post_content', 'prefix_do_testimonial_loop' ); // Add custom loop | |
function prefix_do_testimonial_loop() { | |
$args = array( | |
'post_type' => 'testimonials', // enter your custom post type | |
'orderby' => 'menu_order', | |
'order' => 'ASC', | |
'posts_per_page' => '12', // overrides posts per page in theme settings | |
); | |
$loop = new WP_Query( $args ); | |
if ( $loop->have_posts() ) { | |
while ( $loop->have_posts() ): $loop->the_post(); | |
$client_name = genesis_get_custom_field( '_cd_client_name' ); | |
$client_title = genesis_get_custom_field( '_cd_client_title' ); | |
echo '<div id="testimonials">'; | |
echo '<div class="one-fourth first testimonial">'; | |
echo '<div class="quote-obtuse">'; | |
echo '<span class="pic">'. get_the_post_thumbnail( get_the_ID(), array( 150, 150 ) ).'</span>'; | |
echo '</div>'; | |
echo '<cite class="client">'. esc_attr( $client_name ) .'</cite><span>'. esc_attr( $client_title ) .'</span></cite>'; | |
echo '</div>'; | |
echo '<div class="three-fourths content">'; | |
echo '<h3>' . get_the_title() . '</h3>'; | |
echo '<blockquote><p>' . get_the_content() . '</p></blockquote>'; | |
echo '</div>'; | |
echo '</div>'; | |
endwhile; | |
} | |
// Outro Text (hard coded) | |
$outro = 'Want me to make your next web project easier?'; | |
$outro_link = get_permalink( 1 ); | |
$otro_link_text = 'Let\'s Talk'; | |
echo '<div class="call-to-action">'; | |
echo '<span>' . esc_attr__( $outro, 'textdomain' ) . ' <a href="' . $outro_link . '">' . esc_attr__( $otro_link_text, 'textdomain' ) . '</a></span>'; | |
echo '</div>'; | |
} | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment