the_category(‘ ‘,TRUE) and order
-
I am new to wordpress but have several years php.
the_category() displays parents for the post alphabetically regardless of these being parent or grand parent.
Example:
Aardvark / Dictionary
And I would like it to order with inheritance:
Dictionary / Aardvark
I have been looking around the forum and codex but can not seem to find a solution, many thanks for any suggestions.
π
-
Not seeing your problem with Version 2.7 with the WordPress Default theme
the_category('> ','single') ?>
or
the_category('> ','multiple') ?>works and shows me “parent > child > child of child”
Maybe I’m missing something.
Hi Michael,
Thanks for your reply, here is a link to the dev space:
http://blog.typeslowly.co.uk/web-development/micro-site-and-banner-campaign-for-cartoon-network/
<div id=”breadcrumb”>
<div class=”home”>“>Home
<?php echo the_category(‘ ‘,TRUE); ?></div>
</div>I have set Web Development to be the parent of Micro Sites.
Got to think a plugin might be causing that.
Also, I’m not sure why you need an echo with the_category.
Again, not seeing your problem with Version 2.7 with the WordPress Default theme with this
<?php the_category('> ','single'); ?>Will do some more testing. The echo was in from testing, am new to wordpress.
π
Maccy
Hi Michael,
Default theme and no plugins activated:
http://blog.typeslowly.co.uk/web-development/micro-site-and-banner-campaign-for-cartoon-network/You an see it is putting
micro sites, web development
Web development is the parent so I would like to output:
web development, micro sites
Am I totally misunderstanding how this is suppoesed to work?
In
wp-content/themes/default/single.phpchange
<?php the_category(', ') ?>
to
<?php the_category('> ', 'multiple') ?>Template Hierarchy will give you a feel for what Template WordPress uses in displaying various elements such as archives, pages, and single post views.
Thanks Michael,
<?php the_category(‘> ‘, ‘multiple’) ?>
That is outputting web development twice:
Web Development> Micro Sites> Web DevelopmentThat ‘breadcrump’ just below the header on that page is generated by something not part of the standard WordPress install. If a plugins is doing that, what plugin is being used?
I think this is an IDEA to consider, I’m also trying to achieve the same output for organized categories within the loop, but I cant have an answer in the forums neither in any plugin.
Here’s an example on how I want the_category bellow the post to be listed:Parent 1 > child 1.1, child 1.2, child 1.3
Parent 2 > child 2.1, child 2.2, child 2.3Any help?
Hi Michael,
Thank you for your time it has been invaluable.
I have found the root of the problem and it is due to me ticking the category and the parent category tick boxes in the post edit page rather than just the base category. I am new to wordpress and the reason I did this is because if I just tick the category I want, the interface visually changes and does not show the relationship to its parents.
A note could be added to the codex stating that you should only tick the base category and not the base category and all the parent categories, and that heritage should be set up within the categories edit page to save any confusion. I say this because I have looked at a few wordpress blogs and it seems it is common.
I hope that helps you too kodap, here is a link showing how it functions correctly:
http://wp.typeslowly.co.uk/?p=8Many Thanks.
π
Jason
Thanks for the feedback and for pointing out the problem that is caused by checking both parent and the child categories.
Michael and Maccy, thanks a lot for the tips on this, it has helped me a lot, but just half-progress to what I want to achieve:
(excuse my lack of php skills, I can only understand to integrate the portions of code)I have followed and applied these add-ons to my category-template.php as seen here: http://trac.wordpress.org/attachment/ticket/7251/subcat-separator.diff
but I have more than one assigned parent and further childs on each post: see image here: (parent names in brown, childs in black) http://kodap.com/the_category.png and I managed to add a class to style them.., the above blue links are tags,
all I want is that the parents don’t repeat themselves, alowing all corresponding childs to be nested.
Parent1>> Child1.1, Child1.2,
Parent2>> Child2.1, Child2.2…
Am I missing something? do I have to hack the php so it doesn’t make the parents repeat? unorder alphabetically? – where? – it seems to be the alphabetical order of categories that is causing this..
– Should I write another support post on this issue?btw. I’m using WP 2.6
Thank you!
Following Maccy’s if you have category structures such as (‘Parent’, ‘child of parent’, ‘child of child of parent’) and (‘Parent2’, ‘child of parent 2’, and ‘child of child of parent 2’) then you should only have ‘child of child of parent’ and ‘child of child of parent 2’ checked in your post.
I give up…
The topic ‘the_category(‘ ‘,TRUE) and order’ is closed to new replies.