WordPress.org

Ready to get started?Download WordPress

Ideas

wp_list_categories return number of categories displayed (echo)

  1. Emilian Robert Vicol
    Member

    12345

    Knowing the number of categories present in the result may be useful for html design!

    end function must by like this:

    if ( $echo )
    echo $output;
    return count($categories);
    else
    return $output;

    Of course, the general idea is that some functions to return aditional results in a global variable or by a specialized function.

    Best example is "mysql_error" php function, that "Returns the text of the error message from previous MySQL operation".

    So, wp_last_result() can return extended result from previous function. Certainly it is not necessary for all functions !

    Posted: 2 years ago #
  2. Emilian Robert Vicol
    Member

    12345

    correct code

    if ( $echo ) {
    echo $output;
    return count($categories);
    } else
    return $output;

    sorry for the mistake, I accidentally omitted !

    Posted: 2 years ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    3 Votes
  • Status

    This idea is under consideration