WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_cats vs list_cats (4 posts)

  1. dmclark
    Member
    Posted 10 years ago #

    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 ?

  2. Beel
    Member
    Posted 10 years ago #

    <?php list_cats(1, 'All', 'name', 'asc','',1,'',1,0); ?>
    or
    <?php wp_list_cats('optionall=1&sort_column=name&optioncount=1'); ?>

  3. junesix
    Member
    Posted 10 years ago #

    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, '', '', '').

  4. Anonymous
    Unregistered
    Posted 10 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.