Skip to content

Instantly share code, notes, and snippets.

@subharanjanm
Created October 2, 2015 13:15
Show Gist options
  • Save subharanjanm/a2965ea229ec106435a0 to your computer and use it in GitHub Desktop.
Save subharanjanm/a2965ea229ec106435a0 to your computer and use it in GitHub Desktop.
Display category inside testimonial's cite.
--- wp-content/plugins/testimonials-widget/templates/testimonial-cite.php (revision )
+++ wp-content/plugins/testimonials-widget/templates/testimonial-cite.php (revision )
@@ -62,6 +62,18 @@
$cite = apply_filters( 'tw_cite_html', $cite, $testimonial, $atts );
+$testimonial_category = '';
+$terms = get_the_terms( $testimonial['post_id'], 'category' );
+if ( $terms && ! is_wp_error( $terms ) ) {
+ $term_names = array();
+ foreach ( $terms as $term ) {
+ $term_names[] = $term->name;
+ }
+ $testimonial_category = join( ', ', $term_names );
+}
+
+$cite = $testimonial_category;
+
if ( empty( $cite ) ) {
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment