Title: Display only Title and Category using shortcode
Last modified: December 20, 2017

---

# Display only Title and Category using shortcode

 *  [zschneider](https://wordpress.org/support/users/zschneider/)
 * (@zschneider)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/display-only-title-and-category-using-shortcode/)
 * Hi, thank you for making this plugin and for making it available.
 * I have a small problem that I hope you could assist with. I am showing posts 
   related by tag. I would like to display the Thumbnail + title + post category.
   Using shortcodes, I have only managed to show the title alone or the entire metadata
   using this shortcode.
 * [related_posts_by_tax taxonomies=”post_tag” format=”thumbnails” image_size=”medium”
   posts_per_page=”10″ caption=”post_excerpt” link_caption=”true” title=”באותם נושאים”]
 * Any help would be appreciated.
 * Thanks much,
    Ziv
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdisplay-only-title-and-category-using-shortcode%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/display-only-title-and-category-using-shortcode/#post-9837418)
 * Hi zschneider
 * Sorry for the late reply. Try adding the category with this in your (child) theme’s
   functions.php
 *     ```
       add_filter( 'related_posts_by_taxonomy_caption', 'rpbt_add_category_to_gallery_caption', 10, 2 );
       function rpbt_add_category_to_gallery_caption( $caption, $post ) {
       	$terms = get_the_terms( $post, 'category' );
       	if ( is_wp_error( $terms ) || ! isset( $terms[0] ) ) {
       		return $caption;
       	}
   
       	$term = $terms[0];
   
       	$cat_link .= '<a href="' . esc_url( get_term_link( $term->term_id, 'category' ) ) . '">' . $term->name . '</a>';
       	return  $caption . ' - ' . $cat_link;
       }
       ```
   
 * It will add the link to the post category after the caption
 * btw:
    consider creating a [child theme](https://developer.wordpress.org/themes/advanced-topics/child-themes/)
   instead of editing your theme directly – if you upgrade the theme all your modifications
   will be lost. Or [create a plugin](https://wordpress.org/plugins/pluginception/)
   with the code above.
    -  This reply was modified 8 years, 4 months ago by [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/).

Viewing 1 replies (of 1 total)

The topic ‘Display only Title and Category using shortcode’ is closed to new replies.

 * ![](https://ps.w.org/related-posts-by-taxonomy/assets/icon.svg?rev=1115231)
 * [Related Posts by Taxonomy](https://wordpress.org/plugins/related-posts-by-taxonomy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/related-posts-by-taxonomy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/related-posts-by-taxonomy/)
 * [Active Topics](https://wordpress.org/support/plugin/related-posts-by-taxonomy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/related-posts-by-taxonomy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/related-posts-by-taxonomy/reviews/)

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)

 * 1 reply
 * 2 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/display-only-title-and-category-using-shortcode/#post-9837418)
 * Status: not resolved