Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter despina.mina

    (@despinamina)

    Hello,nothing?

    Something like this should do the trick:

    <?php
    $taxonomy = get_queried_object();
    if(isset($taxonomy->name)){
    echo do_shortcode( '[pj-news-ticker label_text="Latest Posts:" '.$taxonomy->name.'"]' );
    }
    else {
    echo do_shortcode( '[pj-news-ticker]' );
    }
    ?>

    @brianbrown

    Just in case anybody needs it, you can also do something similar to show only the current category:

    $taxonomy = get_queried_object();
    if(isset($taxonomy->slug)){
    echo do_shortcode( '[pj-news-ticker post_cat="'.$taxonomy->slug.'"]' );
    }
    else {echo do_shortcode( '[pj-news-ticker]' );
    }
    ?>

    The else conditional is a failsafe as get_queried_object() returns an empty value under several conditions (so as not to break your layout, etc.).
    Cheers!
    @brianbrown

    Plugin Author Primitiv Media

    (@nicolasmontigny)

    Sorry for the late response, Brian’s answer should do the trick. Will think about adding this to the next version. Will mark this as resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show categories’ is closed to new replies.