[wp-hackers] ordering the cats in a particular order
Alex Rayan
alexrayan69 at gmail.com
Mon Apr 16 13:35:34 UTC 2012
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
>
More information about the wp-hackers
mailing list