1

Hi all I am newbie to wordpress I am using the wp_list_categories in the sidebar to display the categories . How can i display thus categories sort by id any one much appreciated...

<?php wp_list_categories('exclude=73');?>

1 Answer 1

2

wp_list_categories takes an orderby parameter which accepts :

  • ID - Default
  • name
  • slug
  • count
  • term_group

So the default behavior of wp-list-categories is to order by ID but you can specify that like so:

<?php wp_list_categories(array('exclude'=> 73,'orderby' => 'ID'));?>
4
  • I get this error Parse error: syntax error, unexpected '-', expecting '(' in /home/content/67/7399467/html/banas/wp-content/themes/Banas/sidebar.php on line 6 Dec 24, 2012 at 15:37
  • <?php wp_list_categories(array('exclude'=> 73,'orderby' => 'ID'));?> and it's working thanks Much appreciated Dec 24, 2012 at 15:48
  • opps, fixed it.
    – Bainternet
    Dec 24, 2012 at 15:49
  • Many thanks ,Without your help i did'nt solve that problem ... Dec 24, 2012 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.