Tribe_Meta_Box::dropdown_posts( $args = '' )
Source
File: lib/tribe-meta-box.php
public function dropdown_posts( $args = '' ) { $defaults = array( 'numberposts' => -1, 'post_type' => 'post', 'depth' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'class' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '', ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); $get_posts_args = compact( 'post_type', 'numberposts' ); $pages = get_posts( $get_posts_args ); $output = ''; $name = esc_attr( $name ); // Back-compat with old system where both id and name were based on $name argument if ( empty( $id ) ) $id = $name; if ( ! empty( $pages ) ) { $output = "<select name=\"$name\" id=\"$id\" class=\"$class\">\n"; if ( $show_option_no_change ) $output .= "\t<option value=\"-1\">$show_option_no_change</option>"; if ( $show_option_none ) { $output .= "\t<option value=\"" . esc_attr( $option_none_value ) . "\">$show_option_none</option>\n"; } $output .= walk_page_dropdown_tree( $pages, $depth, $r ); $output .= "</select>\n"; } $output = apply_filters( 'dropdown_posts-' . $post_type, $output ); if ( $echo ) { echo $output; } return $output; }