Only show main category in output on post slider

jonathan's Avatar


01 Oct, 2018 09:01 AM

I am having a post slider on
I would like to have only the MAIN category to show as links in the thumbnails. How do I do that?
This is my markup.

`<div class="rsContent">
  <div class="rsCaption">
  <h3><a href="{{link_url}}">{{title}}</a></h3>
  <div class="rsTmb">
    <h4><a href="{{link_url}}">{{title}}</a></h4>
  <a class="rsLink" href="{{link_url}}">{{title}}</a>

I checked already and tried to work with that, but I can't find the answer.

Thanks for your help and your awesome plugin!


  1. Support Staff 1 Posted by Dmitry Semenov on 01 Oct, 2018 03:41 PM

    Dmitry Semenov's Avatar


    There is no built-in option that would allow to display only top-level category. You'll need to create a custom variable that would return the desired content. There is an example of creating a variable for posts-slider here -

    WordPress doesn't have one-liner to retrieve top-level category of a post, on how to get it check discussions like -

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac