Support » Fixing WordPress » Is Parent selected when Child Category is chosen?

  • In WordPress the:

    is filed under <?php the_category(', ') ?>

    lists the categories that your post is filed under. Now, if you choose only the child of a Parent, say Cat1 > Sub1, will it show only Sub1 or will it show Cat1, Sub1?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Show “Cat1 > Sub1” where? Such a hierarchy is shown in the url when using custom permalinks, but if you mean the page title for that sub-category, no.

    Or are you asking something completely different?

    In the “Filed Under” that comes with most of the templates. The “gray box” as so many call it where it says “Posted on blah date and filed under this and that categories and you can rss and pingback, etc.”

    In the tag <?php the_category(', ') ?> does it include the parent or just the child if the parent is unchecked when the post is saved?

    Ah. The default is to link/display just the child, with no parent<>child relationship exhibited. To change this, see the info on the ‘parent’ parameter:

    http://codex.wordpress.org/Template_Tags/the_category

    (I know you know how to find it, but one never knows who is reading.)

    Little more expo on ‘parent’:

    single: Parent/Child – single link
    multiple: Parent/Child – link to each

    Yes, but there is a feature:

    (string) How to display links that reside in child (sub) categories. Options are:

    * "multiple" - Display separate links to parent and child categories, exhibiting "parent/child" relationship.
    * "single" - Display link to child category only, with link text exhibiting "parent/child" relationship.

    So how do you use this? I would want the multiple.

    Different parameters use different methods, some with single quotes and commas, some with equals and ampersands…how would this work to put the multiple parameter in?

    I missed this on the first read through of the template tag.

    Ah, I’m really slow tonight. It says:

    <?php the_category('separator', 'parents' ); ?>

    So I’m going to try:

    <?php the_category(', ', 'multiple') ?>

    and see what it gets me.

    <?php the_category(', ', 'multiple'); ?>
    <?php the_category(', ', multiple); ?>

    Both will work, though ‘we’ suggest using the quotes (just to keep in the habit for text strings).

    Well, I tried it and this is what I got:

    Filed under Cat1, Cat2/Sub1, Cat3...

    I don’t like the slash to denote the parent/child relationship. Wish there was a way to make that just part of the comma lines so it would list:

    Filed under Cat1, Cat2, Sub1, Cat3...

    Oh, we always ask so much…

    Thanks for your help on this. If I’d plugged at it long enough, I could have figured it out, but I so love being the questioner once in a while.

    I think the question was “why can’t I modify all the WordPress features through simple parameters to my heart’s delight?”

    And the answer is “because.”

    Yes. Sadly, that _is_ the answer.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Is Parent selected when Child Category is chosen?’ is closed to new replies.