Only show main category in output on post slider

jonathan's Avatar

jonathan

01 Oct, 2018 09:01 AM

I am having a post slider on http://businessformission.org
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">
  {{image_tag}}
  <div class="rsCaption">
  <h3><a href="{{link_url}}">{{title}}</a></h3>
  </div>
    {{html}}
  <div class="rsTmb">
    <h4><a href="{{link_url}}">{{title}}</a></h4>
    <p>{{categories}}</p>
  </div>
  {{animated_blocks}}
  {{#link_url}}
  <a class="rsLink" href="{{link_url}}">{{title}}</a>
  {{/link_url}}
</div>`

I checked already http://help.dimsemenov.com/kb/wordpress-royalslider-tutorials/wp-using-slide-markup-editor and tried to work with that, but I can't find the answer.

Thanks for your help and your awesome plugin!

Jonathan

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

    Dmitry Semenov's Avatar

    Hello,

    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 - http://help.dimsemenov.com/kb/wordpress-royalslider-advanced/wp-add...

    WordPress doesn't have one-liner to retrieve top-level category of a post, on how to get it check discussions like - https://stackoverflow.com/questions/8823452/wordpress-function-to-g...

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

Generic

? 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