In Genesis, we have to do everything with hooks and filters. Here’s enough to get you started.
Functions
Add these to your functions.php file. (The purist in me wants to recommend a separate file for these functions but I’m not sure which Genesis hook to hang it on.)
/**
* Add custom fields from Strong Testimonials to single testimonial posts.
*
* @param $content
*
* @return mixed
*/
function genesis_child_content_filter( $content ) {
if ( is_singular( 'wpm-testimonial' ) ) {
$content .= '<div class="testimonial-client">';
$content .= '<div class="testimonial-name">' . wpmtst_get_field( 'client_name' ) . '</div>';
$content .= '<div class="testimonial-company"><a href="' . wpmtst_get_field( 'company_website' ) . '" target="_blank">' . wpmtst_get_field( 'company_name' ) . '</a></div>';
$content .= '</div>';
}
return $content;
}
add_filter( 'the_content', 'genesis_child_content_filter' );
Since the testimonial view settings are not available at this point, you will have to hardcode the custom field names and CSS classes. Adjust accordingly.
/**
* Remove the post info line on single testimonial posts.
*
* @param $post_info
*
* @return string
*/
function genesis_child_post_info( $post_info ) {
if ( is_singular( 'wpm-testimonial' ) ) {
return '';
}
return $post_info;
}
add_filter( 'genesis_post_info', 'genesis_child_post_info' );
/**
* Add the featured image to single testimonial posts.
*/
function genesis_child_featured_image() {
if ( is_singular( 'wpm-testimonial' ) ) {
the_post_thumbnail( 'post-image' );
}
}
add_action( 'genesis_entry_content', 'genesis_child_featured_image', 8 );
Style
You will have to copy the CSS from the plugin template to your theme. For example, the default template stylesheet is /plugins/strong-testimonials/templates/default/content.css. Look at the Base, Template, and Responsive sections. You will need to remove each occurrence of .strong-view.default.
You can either add the CSS to your main stylesheet or create a separate stylesheet. I recommend the latter for easier editing and portability. For example, create a stylesheet named wpm-testimonial.css and load it like this:
function genesis_child_enqueue_testimonial_style() {
if ( is_singular( 'wpm-testimonial' ) ) {
wp_enqueue_style( 'single-testimonial-style', get_stylesheet_directory_uri() . '/wpm-testimonial.css' );
}
}
add_action( 'wp_enqueue_scripts', 'genesis_child_enqueue_testimonial_style' );
If you add it to your main stylesheet instead, you may want to maintain the high specificity by replacing each occurrence of .strong-view.default with .wpm-testimonial which is the class name automatically added to the <article> element.