WordPress.org

Ready to get started?Download WordPress

Forums

Different way of displaying sub-categories? (4 posts)

  1. Kasmus
    Member
    Posted 9 years ago #

    Hi WordPressers!
    Is there a way of displaying sub-categories in the format category:sub-category?
    Since I'm using many sub-categories to organize my posts and I always have to additionally select the category of the respective sub-category in order to get it displayed in the sidebar, it's quite confusing to have the category displayed seperately under each post.
    Have a look at http://projektor.bundespest.de/ and you'll understand... :D
    Kasmus

  2. Dirk
    Member
    Posted 9 years ago #

    Can you clarify? Your posts seem to be in several categories.

  3. Kasmus
    Member
    Posted 9 years ago #

    Sure, let's simply have an example:
    The post Pongmechanik ist lited in the following categories:
    Netz
    -Kultur
    Technikzeug
    -Gadgets
    As you can see Kultur and Technikzeug both are subcategories.
    Now I want WP to display them below the posting in a way that makes the hierarchy clear.
    WP currently simply displays the selected categories & subcategories in alphabetical order. For the example above this is:
    Kategorie: Technikzeug, Netz, Kultur, Gadgets
    I would prefer this way:
    Kategorie: Technikzeug: Gadgets, Netz: Kultur
    Is there any way to do this?
    Kasmus

  4. DennisWilliamson
    Member
    Posted 9 years ago #

    Correction: A space is added after the separator string in the output of the function. So calling the_category(',') would display "Category1, Category2, Category3". The space is hard-coded and can't be over-ridden.
    See this entry in the Wiki for a replacement function which allows more flexibility in the use of separators and fixes the single/multiple bug (which has been fixed in the development version on the CVS).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.