Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




parent_dropdown [ WordPress Function ]

parent_dropdown ( $default = 0, $parent = 0, $level = 0 )
Parameters:
  • (unknown_type) $default
  • (unknown_type) $parent
  • (unknown_type) $level
Returns:
  • (unknown)
Defined at:



{@internal Missing Short Description}}

Source


<?php
function parent_dropdown$default 0$parent 0$level ) {
    global 
$wpdb$post_ID;
    
$items $wpdb->get_results$wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order"$parent) );

    if ( 
$items ) {
        foreach ( 
$items as $item ) {
            
// A page cannot be its own parent.
            
if (!empty ( $post_ID ) ) {
                if ( 
$item->ID == $post_ID ) {
                    continue;
                }
            }
            
$pad str_repeat'&nbsp;'$level );
            if ( 
$item->ID == $default)
                
$current ' selected="selected"';
            else
                
$current '';

            echo 
"\n\t<option class='level-$level' value='$item->ID'$current>$pad " esc_html($item->post_title) . "</option>";
            
parent_dropdown$default$item->ID$level +);
        }
    } else {
        return 
false;
    }
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics