wp_dropdown_pages example

<?php if ( ! empty( $this->label ) ) : ?> <label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label> <?php endif; ?> <?php if ( ! empty( $this->description ) ) : ?> <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> <?php endif; ?> <?php                 $dropdown_name     = '_customize-dropdown-pages-' . $this->id;
                $show_option_none  = __( '&mdash; Select &mdash;' );
                $option_none_value = '0';
                $dropdown          = wp_dropdown_pages(
                    array(
                        'name'              => $dropdown_name,
                        'echo'              => 0,
                        'show_option_none'  => $show_option_none,
                        'option_none_value' => $option_none_value,
                        'selected'          => $this->value(),
                    )
                );
                if ( empty( $dropdown ) ) {
                    $dropdown  = sprintf( '<select id="%1$s" name="%1$s">', esc_attr( $dropdown_name ) );
                    $dropdown .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $option_none_value )esc_html( $show_option_none ) );
                    
'edit.php?post_type=page'
        );
        ?> </label> </p> <ul> <li><label for="page_on_front"> <?php     printf(
        /* translators: %s: Select field to choose the front page. */
        __( 'Homepage: %s' ),
        wp_dropdown_pages(
            array(
                'name'              => 'page_on_front',
                'echo'              => 0,
                'show_option_none'  => __( '&mdash; Select &mdash;' ),
                'option_none_value' => '0',
                'selected'          => get_option( 'page_on_front' ),
            )
        )
    );
    ?> </label></li> <li><label for="page_for_posts">
_e( 'Change your Privacy Policy page' );
                    } else {
                        _e( 'Select a Privacy Policy page' );
                    }
                    ?> </label> </th> <td> <form method="post" action=""> <input type="hidden" name="action" value="set-privacy-page" /> <?php                     wp_dropdown_pages(
                        array(
                            'name'              => 'page_for_privacy_policy',
                            'show_option_none'  => __( '&mdash; Select &mdash;' ),
                            'option_none_value' => '0',
                            'selected'          => $privacy_policy_page_id,
                            'post_status'       => array( 'draft', 'publish' ),
                        )
                    );

                    wp_nonce_field( 'set-privacy-page' );

                    
/** * Filters the arguments used to generate a Pages drop-down element. * * @since 3.3.0 * * @see wp_dropdown_pages() * * @param array $dropdown_args Array of arguments used to generate the pages drop-down. * @param WP_Post $post The current post. */
        $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args$post );
        $pages         = wp_dropdown_pages( $dropdown_args );
        if ( ! empty( $pages ) ) :
            ?> <p class="post-attributes-label-wrapper parent-id-label-wrapper"><label class="post-attributes-label" for="parent_id"><?php _e( 'Parent' ); ?></label></p> <?php echo $pages; ?> <?php         endif; // End empty pages check.     endif;  // End hierarchical check.
    if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) :
        $template = ! empty( $post->page_template ) ? $post->page_template : false;
        ?>

                            $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args$bulk );

                            wp_dropdown_pages( $dropdown_args );
                            ?> </label> <?php endif; // hierarchical ?> <?php if ( ! $bulk ) : ?> <label> <span class="title"><?php _e( 'Order' ); ?></span> <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?>" /></span> </label>
Home | Imprint | This part of the site doesn't use cookies.