WP Category Post List Widget
No template tag? (1 post)

  1. YorkshireLad
    Posted 2 years ago #


    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.



Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Category Post List Widget
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic