How do I display current category slug in page (5 posts)

  1. CatholicSin
    Posted 8 years ago #

    I am vaguely aware of programming and how it works (generally enough to get me in trouble). I am trying to have the category slug to actually appear on a page as text, and I can't seem to find it in the supporting documentation. I just am not sure what the code is to have the name of the slug appear on a page post.

    Basically I am using postlist plugin. I would like to use that plugin to display on the sidebar all posts that are involved with that category (by using a widget). I would like to do this dynamically by naming my postlists according to the slug of the category they refer too (which I have already done). All this leaves me is being able to display in text what the slug name for the current category selected in the text, it should dynamically switch the listed posts on the sidebar, depending on what the category is.

    Unless someone knows a plugin that does this, which case I would be happy to be referred to it.

  2. richarduk
    Posted 8 years ago #


    <p> <?php single_cat_title('Currently browsing '); ?>. </p>

    This will display: Currently browsing strawberries if your category is strawberries


  3. CatholicSin
    Posted 8 years ago #

    Thank you very much, I think my problem is I want to display the current slug's name in the sidebar. I am open to more ideas, this isn't quite working.

  4. richarduk
    Posted 8 years ago #

    Try this plugin:

    If you know anything about php this might help you create a category header followed by headlines of posts in a loop within the sidebar depending on what category you're in.

  5. trex33
    Posted 7 years ago #

    There is an excellent plugin for this which adds a template tag for category slug. Upload the plugin and then just add the category slug template tag in the loop

    WP Extra Template Tags

Topic Closed

This topic has been closed to new replies.

About this Topic