• I am using wp_dropdown_categories() to create a drop down.

    I’d like the top option to be the text “Sort by XXXX” instead of having a div above it (for instance) that says “Sort by XXXX”.

    Can someone help me with this? I see that it is not an option in the arguments.

Viewing 1 replies (of 1 total)
  • Thread Starter generalsalt

    (@generalsalt)

    Ok, just figured it out. In category-template.php I added:

    function wp_dropdown_categories( $args = '' ) {
    	$defaults = array(
    		'show_option_all' => '', 'show_option_none' => '',
    		'orderby' => 'ID', 'order' => 'ASC',
    		'show_last_update' => 0, 'show_count' => 0,
    		'hide_empty' => 1, 'child_of' => 0,
    		'exclude' => '', 'echo' => 1,
    		'selected' => 0, 'hierarchical' => 0,
    		'name' => 'cat', 'class' => 'postform',
    		'depth' => 0, 'tab_index' => 0,
    		'top_option' => ''
    	);

    and added this to the output:

    $output .= "<option>$top_option</option>";

    Now top_option is available as a parameter.

Viewing 1 replies (of 1 total)
  • The topic ‘wp_dropdown_categories() Top Option as Subject’ is closed to new replies.