Viewing 6 replies - 1 through 6 (of 6 total)
  • Don’t even know why that worked at 2.7, but the orderby can only be ID, name, slug, count, or term_group (these are actually defined by the function get_terms).

    Thread Starter Jellelle

    (@jellelle)

    well, I thought it worked in 2.7. didn’t had that many categories 🙂
    At lest they where showing up without displaying NO CATEGORIES.

    So there is no way to do this?

    So there is no way to do this?

    -Get all your posts
    -Loop through posts newest to oldest till you’ve got one post for each of your five categories
    -Then display those posts

    Hi Jellelle

    You can also try “My Category Order” plugin (WP 2.8 compatible) to do what you need.

    Usage after manual category switches on admin panel :
    wp_list_categories('orderby=order&...');

    Great addon to override wordpress default way of listing categories 😉

    Cheers,
    Rumores

    Thread Starter Jellelle

    (@jellelle)

    Thanks all!

    Thread Starter Jellelle

    (@jellelle)

    For those who want to know, here is the code I smashed together (no coding guru!)

    <?php
    $cat_posts = new WP_Query('orderby=post_date&showposts=-1');
    $i = 0;
    
    if($cat_posts->have_posts()) :
    	while($cat_posts->have_posts()) : $cat_posts->the_post();
    
    		$category = get_the_category();
    		$allcategoriesID[$i] = $category[0]->cat_ID;
    		$i++;
    
    	endwhile;
    endif;
    
    $recentcategoriesID = array_values(array_unique($allcategoriesID));
    
    for ($counter = 0; $counter <= 1; $counter += 1) {	//Show last 2 categories who have been updated
    	$args_temp = array('include' => $recentcategoriesID[$counter],'title_li'=>'');
    	wp_list_categories($args_temp);
    }
    ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to order category the way I want it?’ is closed to new replies.