Ordering categories in my own order, not alphabetically
-
I’ve read the threads I can find and the orderby in the codex, but I can’t figure it out, so I’m sorry if i’m repeating something that’s already been solved…
I’m trying to do an events listing and want to add the categories in my own order, not alphabetically, i.e.Workshops in January
Workshops in February…
Exhibitions in January
Exhibitions in February…
and so onWhatever i put in it seems to do it in a very non-logical order… can’t figure out where i’m going wrong. Please help. 🙂
Here is the code:<!--script that list all posts in categories under events starts--> <?php //for each category, show posts $cat_args=array( 'include' => '2550,2551,2552,2553,2554,2555,2556,2557,2558,2559,2560,2561,69,2574,2575,2576,2577,2578,2579,2580,2581,2582,2583,2584,2585,16,2562,2563,2564,2565,2566,2567,2568,2569,2570,2571,2572,2573,70,2526,2527,2528,2529,2530,2531,2532,2533,2534,2535,2536,2537,72,2538,2539,2540,2541,2542,2543,2544,2545,2546,2547,2548,2549,68', 'orderby' => 'ID', 'order' => 'ASC' ); $categories=get_categories($cat_args); foreach($categories as $category) { $args=array( 'showposts' => -1, 'category__in' => array($category->term_id), 'caller_get_posts'=>1 ); $posts=get_posts($args); if ($posts) { echo '<h2>' . $category->name.'</a> </h2> '; foreach($posts as $post) { setup_postdata($post); ?> <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php } // foreach($posts } // if ($posts } // foreach($categories ?>
- The topic ‘Ordering categories in my own order, not alphabetically’ is closed to new replies.