Advertisements

wp_dropdown_cats

Definition:
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {}

Parameters

  • unknown_type $currentcat
  • unknown_type $currentparent
  • unknown_type $parent
  • unknown_type $level
  • unknown_type $categories

Source code

function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {

	_deprecated_function( __FUNCTION__, '3.0', 'wp_dropdown_categories()' );

	if (!$categories )

		$categories = get_categories( array('hide_empty' => 0) );



	if ( $categories ) {

		foreach ( $categories as $category ) {

			if ( $currentcat != $category->term_id && $parent == $category->parent) {

				$pad = str_repeat( '– ', $level );

				$category->name = esc_html( $category->name );

				echo "\n\t<option value='$category->term_id'";

				if ( $currentparent == $category->term_id )

					echo " selected='selected'";

				echo ">$pad$category->name</option>";

				wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );

			}

		}

	} else {

		return false;

	}

}

3613

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: