WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp_dropdown_pages (3 posts)

  1. nick50119
    Member
    Posted 3 years ago #

    I am trying to used wp_dropdown_pages in a form in the admin page of my plugin. The idea is to use it to select the page where a widget will be displayed.

    I have this working, the dropdown shows up where it is supposed to and works functionally.

    '              <tr><th><label>Game Results Widget Page</label></th>' . "\n" .
      '                  <td>' .wp_dropdown_pages(array('name'=>'bbnuke_plugin_option_game_results_page','selected'=>"$game_results_page")) . "\n" .
      '                  </td>' . "\n" .
      '              </tr>' . "\n" .
    '

    the problem is, that is shows up as a duplicate in other parts of the page. I have verified that all the tags are closed. If I build a dropdown menu manually there are no problems, only when using wp_dropdown_pages.

    Am I using wp_dropdown_pages incorrectly? Can someone tell me exactly what it is returning? I am assuming it is <select><options....></select>.

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    if you want to use it within strings, you may need to set the 'echo' parameter to 'false' in wp_dropdown_pages()
    http://codex.wordpress.org/Function_Reference/wp_dropdown_pages

  3. nick50119
    Member
    Posted 3 years ago #

    THANK YOU! That did the trick.

Topic Closed

This topic has been closed to new replies.

About this Topic