[wp-hackers] ordering the cats in a particular order
Haluk Karamete
halukkaramete at gmail.com
Mon Apr 16 15:58:24 UTC 2012
Since it's written by scribu, I don't think we need to test it.
On Mon, Apr 16, 2012 at 8:17 AM, Alex Rayan <alexrayan69 at gmail.com> wrote:
> Alright,
>
> I found this that you could probably use:
>
> http://wordpress.stackexchange.com/questions/29033/better-way-to-enforce-category-hierarchy-in-post-categories-metabox
>
> As of now, there is no direct filter on wp_terms_checklist. And replicating
> the same code might not be the best idea.
> There is, however, a plugin that seems to be working (haven't tested it
> myself):
> http://wordpress.org/extend/plugins/category-checklist-tree/
>
> Hope, it helps.
>
>
> On Mon, Apr 16, 2012 at 10:56 AM, Alex Rayan <alexrayan69 at gmail.com>
> wrote:
>
> > Yes, I wrap it in a function. So far I used it directly in templates
> since
> > I needed certain functionality for sliders, tabs, etc. displaying
> > categories in particular order on specific pages, but you could call the
> > function on the hook you need.
> >
> > I did a bit of Googling on the category hooks and, perhaps, this page
> > could be helpful:
> > http://adambrown.info/p/wp_hooks/hook/the_category
> >
> > Regards,
> > Alex
> >
> >
> > On Mon, Apr 16, 2012 at 10:41 AM, Haluk Karamete <
> halukkaramete at gmail.com>wrote:
> >
> >> Thank you Alex.
> >> What would be the hook for this so that the cats can be ordered in a
> >> particular order?
> >>
> >> I assume that you'll wrap all that array reordering into a function and
> >> call it with a hook. Right?
> >>
> >>
> >>
> >> On Mon, Apr 16, 2012 at 6:35 AM, Alex Rayan <alexrayan69 at gmail.com>
> >> wrote:
> >>
> >> > Hi Haluk,
> >> >
> >> > I always used array unset to unset the objects I want to switch, then
> >> > append them back to an array and use ksort on it.
> >> > Example (switch finance and metals categories):
> >> >
> >> > $categories = get_categories($args);
> >> > $finance = $categories[1];
> >> > unset($categories[1]);
> >> > $metals = $categories[4];
> >> > unset($categories[4]);
> >> > $categories[1]=$metals;
> >> > $categories[4]=$finance;
> >> > ksort($categories);
> >> >
> >> > But maybe someone knows a more efficient way of doing it in WP.
> >> >
> >> > Regards,
> >> > Alex
> >> >
> >> > On Sun, Apr 15, 2012 at 3:28 PM, Haluk Karamete <
> >> halukkaramete at gmail.com
> >> > >wrote:
> >> >
> >> > > Is there a way to define the order of category items ( or any
> >> > > other hierarchical taxonomy for that matter ) in the admin UI when
> >> > adding a
> >> > > new post?
> >> > >
> >> > > Example
> >> > >
> >> > > Change this
> >> > >
> >> > > cat1
> >> > > cat 1.1
> >> > > cat 1.2
> >> > > cat 1.3
> >> > > cat2
> >> > > cat 2.1
> >> > > cat 2.2
> >> > > cat3
> >> > > cat 3.1
> >> > > cat 3.2
> >> > > cat 3.1
> >> > > cat 3.2
> >> > > cat4
> >> > > cat 4.1
> >> > >
> >> > >
> >> > > to...
> >> > >
> >> > > cat1
> >> > > cat 1.1
> >> > > cat 1.2
> >> > > cat 1.3
> >> > > cat2
> >> > > cat 2.1
> >> > > cat 2.2
> >> > > cat4
> >> > > cat 4.1
> >> > > cat3
> >> > > cat 3.1
> >> > > cat 3.2
> >> > > cat 3.1
> >> > > cat 3.2
> >> > >
> >> > >
> >> > > notice cat 3 and cat4 trees are switched.
> >> > > _______________________________________________
> >> > > wp-hackers mailing list
> >> > > wp-hackers at lists.automattic.com
> >> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >> > >
> >> > _______________________________________________
> >> > wp-hackers mailing list
> >> > wp-hackers at lists.automattic.com
> >> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >> >
> >> _______________________________________________
> >> wp-hackers mailing list
> >> wp-hackers at lists.automattic.com
> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >>
> >
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list