• 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

    https://www.ads-software.com/plugins/wp-category-posts-list/

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