• rdepp01

    (@rdepp01)


    Hi,
    I want to use wp_dropdown_pages to allow navigation to all the pages on my site. However by default it doesn’t include the home page in the list. There is an option with wp_page_menu call show_home which sounds like exactly what I need. I tried it with wp_dropdown_pages but it doesn’t seem to be supported.

    Can anyone suggest a way to add the home page as one of the pages displayed by wp_dropdown_pages, or else point me in the direction of a suitable plugin replacement. The site I am working on is:

    https://www.carrigalineeducatetogether.ie

    Thanks,
    Ralph

Viewing 1 replies (of 1 total)
  • churchthemer

    (@churchthemer)

    I think wp_page_menu() is a function slated for release with WP 2.7.

    Anyway, this is incredibly hacky but . . .

    <?php
      $frontpage_id = get_option('page_on_front');
      $dropdown = wp_dropdown_pages('echo=0&name=page_id');
      $dropdown = str_replace("<select name='page_id'>","<select name='page_id'><option value=\"$frontpage_id\">Home</option>",$dropdown);
      echo $dropdown;
    ?>

    The above grabs the id of the frontpage and inserts it as the value for the “hacked in” home option. In most cases this value will be “0”. When you submit this form you’ll have to decide what to do with that value.

    Hope that gets you headed in the right direction.

Viewing 1 replies (of 1 total)
  • The topic ‘Support for show_home in wp_dropdown_pages’ is closed to new replies.