WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
[resolved] Dropdown Selected Option (8 posts)

  1. jennygold
    Member
    Posted 3 years ago #

    How can I populate the first dropdown option (currently blank & marked as "selected") with the taxonomy name?

  2. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    That would mean that you don't want the taxonomy name to be displayed before the <select>, as it is now, right?

  3. jennygold
    Member
    Posted 3 years ago #

    That's right. Output the taxonomy as the first option and not have it appear outside of the dropdown.

  4. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    Open widget.php and replace this:

    get_taxonomy( $taxonomy )->label . ': ' . scbForms::input( array(

    with this:

    scbForms::input( array(
      'text' => get_taxonomy( $taxonomy )->label,
  5. jennygold
    Member
    Posted 3 years ago #

    That's fabulous. Thanks so much!

  6. smdever
    Member
    Posted 3 years ago #

    Just to build on this question, how do I populate the first dropdown option with the first taxonomy tag?

    As a concrete example, I have a dropdown for "City" taxonomy with 2 cities in it, Bangkok and Chiang Mai. I'd like Bangkok to appear as the default selected option.

  7. elba00
    Member
    Posted 3 years ago #

    It looks you've changed the plugin since you answered to jennygold. I don't find the same exact line in the current version of the. Would you please help me out how to achieve the same efffect? Thanks.

  8. patricksilva
    Member
    Posted 3 years ago #

    I got the solution.

    Go to widget.php, search for

    .html( 'select', array( 'name' => qmt_get_query_var( $taxonomy ) ),
    					'<option></option>'

    (line 179 and 180 to me)

    And change <option></option>' to <option>My first option here</option>'

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic