Possible to display only top-level category?

blake's Avatar

blake

04 Mar, 2013 03:17 AM

I understand this may be outside scope but if you have a quick answer that would be helpful.

I'm using {{categories}} and it returns all the categories a post is assigned to, including sub categories mixed in with the parent (e.g. parent,sub, sub)

Is it possible to display only the top level category a post belongs to?

Thanks!

  1. Support Staff 1 Posted by Dmitry Semenov on 04 Mar, 2013 01:57 PM

    Dmitry Semenov's Avatar

    Hi,

    There is no option for this in admin. But if you're experienced in PHP, you may implement it by adding custom variable to markup editor http://help.dimsemenov.com/kb/wordpress-royalslider-advanced/wp-add...

    Dmitry

  2. 2 Posted by jonathan on 25 Sep, 2018 09:23 AM

    jonathan's Avatar

    Hi Dmitry,

    How would you do this? To only show the top category? I don't have that much experience in php.

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