Created
March 24, 2017 10:34
-
-
Save craigsimps/16fad684d5f756a28d63c99a025147f7 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: Testimonials - ACF Functions | |
*/ | |
add_action( 'genesis_entry_content', 'prefix_output_testimonials' ); | |
/** | |
* Output ACF testimonials. | |
* | |
* @link https://acfextras.com/simple-testimonials-repeater-field/ | |
*/ | |
function prefix_output_testimonials() { | |
if ( have_rows( 'testimonials' ) ) : | |
echo '<div class="testimonials">'; | |
while ( have_rows( 'testimonials' ) ): the_row(); | |
$testimonial = get_sub_field( 'testimonial' ); | |
$image = get_sub_field( 'image' ); | |
$byline = get_sub_field( 'byline' ); | |
if ( $testimonial ) { | |
echo '<div class="testimonial">'; | |
echo '<div class="testimonial-content">'; | |
if ( $image ) { | |
echo '<div class="testimonial-image alignright">'; | |
echo wp_get_attachment_image( $image, 'thumbnail' ); | |
echo '</div>'; | |
} | |
echo wp_kses_post( $testimonial ); | |
echo '</div>'; | |
if ( $byline ) { | |
echo '<div class="testimonial-byline">' . esc_html( $byline ) . '</div>'; | |
} | |
} | |
echo '</div>'; | |
endwhile; | |
echo '</div>'; | |
endif; | |
} | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment