• Still trying to understand the way functions are named.
    What I am trying to do is have the # of posts for a category after its name. Can I do that as a variables passed to iwp_list_catI or would have to write a custom function for that ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php list_cats(1, ‘All’, ‘name’, ‘asc’,”,1,”,1,0); ?>
    or
    <?php wp_list_cats(‘optionall=1&sort_column=name&optioncount=1’); ?>

    You should use wp_list_cats instead of list_cats. With list_cats, you have to provide a value for every parameter which is very tedious. With wp_list_cats, you only provide string arguments for parameters you want to change, and the function fills in the remaining parameters with default values. (wp_list_cats actually takes your arguments and fills in the blanks before passing it on to list_cats).
    In the case of category post counts, use wp_list_cats('optioncount=1'). If you wanted to do the same thing with list_cats, you’d have to use list_cats(0, 'All', 'ID', 'asc', '', true, 0, 1, 1, 1, true, 0, 0, 0, '', '', '').

    You can chop everything off after the optioncount variable to produce this: list_cats(0, 'All', 'ID', 'asc', '', true, 0, 1);

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp_list_cats vs list_cats’ is closed to new replies.