WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I show the all menu which i have on the top in dropdown style when site is open in mobiles. I successfully display them in dropdown style but the problem is that how can i indend my subpages. or make parent pages bolg is any way to do that, my code is

<nav id="nav-mobile" role="navigation">
                <select id="mob_menu" name="page-dropdown"> 
                 <option value="">
                <?php echo esc_attr( __( 'Select page' ) ); ?></option> 
                  $pages = get_pages(); 
                  foreach ( $pages as $page ) {
                    $option = '<option value="' . get_page_link( $page->ID ) . '">';
                    $option .= $page->post_title;
                    $option .= '</option>';
                    echo $option;

share|improve this question
You indent and change the font-weight (bold) the output with CSS. There doesn't seem to be anything WordPress specific to this question. – s_ha_dum May 22 '13 at 14:27
up vote 0 down vote accepted

Use wp_dropdown_pages():

print '<form action="' . home_url() . '">';
print '<input type=submit></form>';

You get a select field with proper indentation, and clicking on the button will send the user to that page.

enter image description here

share|improve this answer
Thanks lots, this is the result i need. – Adi May 22 '13 at 15:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.