Title: No template tag?
Last modified: August 21, 2016

---

# No template tag?

 *  [YorkshireLad](https://wordpress.org/support/users/yorkshirelad/)
 * (@yorkshirelad)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/no-template-tag/)
 * Hi,
 * Using the widget, I can list posts relating to the current category. If I use
   the shortcode, I can lists posts with cat_id=x. If I want to use a template tag
   to do the same as the widget… I can’t – as far as I can tell there isn’t one,
   and using do_shortcode won’t work, as leaving out the cat_id will bring up everything.
 * Of course, I might be missing something!
 * But here’s how I got around my problem. First, determine the category id; then
   manually build your shortcode before ‘do’ing it (you don’t need all the options
   I’m using here):
 *     ```
       $scategory = get_the_category();
       $scat2 = $scategory[0]->cat_ID;
       $shortcat="[wp_cpl_sc cat_id=" . $scat2 . " show_author=false optional_excerpt=true read_more='' show_date=false show_comments=false is_thumb=true]";
       echo (do_shortcode($shortcat));
       ```
   
 * Like I said, I might have missed there being a template tag, but if there really
   isn’t one then I hope my hack helps.
 * Gary
 * [http://wordpress.org/plugins/wp-category-posts-list/](http://wordpress.org/plugins/wp-category-posts-list/)

The topic ‘No template tag?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-category-posts-list_edefec.svg)
 * [WP Category Post List Widget](https://wordpress.org/plugins/wp-category-posts-list/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-category-posts-list/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-category-posts-list/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-category-posts-list/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-category-posts-list/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-category-posts-list/reviews/)

## Tags

 * [template tag](https://wordpress.org/support/topic-tag/template-tag/)

 * 0 replies
 * 1 participant
 * Last reply from: [YorkshireLad](https://wordpress.org/support/users/yorkshirelad/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/no-template-tag/)
 * Status: not resolved