mtekk / Order-Bender

A small WordPress plugin that allows you to set the primary category for a post. Works in conjunction with Breadcrumb NavXT to specify a category hiearchy.
14 stars 8 forks source link

Affect the tag too #3

Open gasatrya opened 9 years ago

gasatrya commented 9 years ago

I just try the this 'addon' the problem is now my category displayed twice and the tag too :(

http://cl.ly/image/2I0d0P0j1z32 and http://cl.ly/image/2P430v2T003O

mtekk commented 9 years ago

I need more information about your environment (theme, other plugins, WordPress version, PHP version, HTTP server and version). There must be something in your setup that is causing this as I can't reproduce this on my local testbed. And, by looking at the code, it would appear that the only way for things to get doubled up is if unset() is not working, which is very odd.

gasatrya commented 9 years ago

I actually used Order Bender too, I modified the code just like http://mtekk.us/archives/wordpress/plugins-wordpress/specifying-a-preferred-category-hierarchy/comment-page-1/#comment-92746 because your original code isn't worked.

I'm using ThemeJunkie theme, I build it actually. I just use WordPress standard code, to call the categories I use get_the_category_list() and for the tags get_the_tag_list(); there are no special code in this theme.

gasatrya commented 9 years ago

I found this http://wordpress.stackexchange.com/a/48737, the commenter said if you use get_the_terms filter "it will have effect on different other functions, which use get_the_terms internally".

gasatrya commented 9 years ago

Oh it also effect the terms on admin page http://cl.ly/image/1d2h263U3g0j

gasatrya commented 9 years ago

One more question, why you don't include the order bender function into the Breacrumb NavXT it self?

mtekk commented 9 years ago

So, are you experiencing this issue with the actual code provided in this repository, or only after modifying it per the one comment on my site? That comment was only relevant for an earlier version of Order Bender that only allowed the top category to be selected. That limitation has since been removed. And, per #2 it appears that code has a bug that causes what you are seeing.

This plugin is designed to change the order of taxonomy terms for everything, it is not a Breadcrumb NavXT specific plugin. It does happen to help exploit a behavior in Breadcrumb NavXT, allowing one to specify the taxonomy term hierarchy to follow when a post is a member of multiple hierarchies.

This functionality is not built into Breadcrumb NavXT for several reasons, and to do the answer justice I'll need several paragraphs (likely a future post). In the end it boils down to wanting to keep the core of Breadcrumb NavXT simple, fast, and extensible.

gasatrya commented 9 years ago

First I tried the code in this repository but it wasn't work, then I found the code in the comment. I tried it and it works, but then this issue appear.

gasatrya commented 9 years ago

I have several categories. Brands

Display

I want the breadcrumbs use the brands category but my post uses the Display category. I've tried the original Order Bender but no luck.

mtekk commented 9 years ago

For a post, if you select the deepest category as the "Preferred Category" in Order Bender, then Breadcrumb NavXT should be able to pick it up (I just tested it on my local testbed). So if the post is a member of a brand category (e.g. Asus) and a display category (e.g. 5 inches), and set the preferred category to one that is a child of Brands (e.g. Asus) then that should be the category hierarchy that is followed. This relies on the brands categories to be children of "Brands" and the display categories to be children of "Display".

In the end, for this use case, it may make much more sense to use custom taxonomies. Having a custom taxonomy of Brands and a custom taxonomy of Display makes more sense from a semantical point of view.

gasatrya commented 9 years ago

I tried to replace the code with the original code in this repository. Then I tried to replace the parent category each existing posts but still not worked, then I tried with new post. It worked. So, I thought the code is just for new post?