コード例 #1
0
function simple_sidenav_pages($args = '')
{
    $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $pages = get_pages($r);
    if (ssn_get_option('blog_post_links')) {
        $posts = get_posts('numberposts=-1');
        $pages = array_merge($pages, $posts);
    }
    $output = '';
    if (!empty($pages)) {
        if ($show_option_no_change) {
            $output .= "\t<option value=\"-1\">{$show_option_no_change}</option>";
        }
        if ($show_option_none) {
            $output .= "\t<option value=\"{$option_none_value}\">{$show_option_none}</option>\n";
        }
        $output .= walk_page_dropdown_tree($pages, $depth, $r);
    }
    $output = apply_filters('wp_dropdown_pages', $output);
    if ($echo) {
        echo $output;
    }
    return $output;
}
コード例 #2
0
function msc_alwaysloaddropdown_pages($args = '')
{
    $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $pages = get_pages($r);
    $output = '';
    if (empty($id)) {
        $id = $name;
    }
    if (!empty($pages)) {
        $output = "<select name='" . esc_attr($name) . "' class='" . esc_attr($class) . "' id='" . esc_attr($id) . "'>\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('wp_dropdown_pages', $output);
    if ($echo) {
        echo $output;
    }
    return $output;
}
コード例 #3
0
/**
 * Add the dropdown filter listing all available parent posts to filter by.
 *
 * @since 1.0.0
 *
 * @global string $typenow The current post type being managed.
 */
function parentfilter_add_dropdown()
{
    global $typenow;
    $post_type_obj = get_post_type_object($typenow);
    if ($post_type_obj->hierarchical) {
        // Build the query for the dropdown
        $request = array('post_type' => $typenow, 'post_parent' => '', 'posts_per_page' => -1, 'orderby' => array('menu_order', 'title'), 'order' => 'asc', 'selected' => null, 'plugin-context' => 'parent-filter');
        // Update the selected option if needed
        if (isset($_GET['post_parent'])) {
            $request['selected'] = $_GET['post_parent'];
        }
        // Run the query
        $query = new WP_Query($request);
        // Print the dropdown
        echo '<select name="post_parent" id="parent_filter">';
        // Print the no filtering option
        echo '<option value="">' . __('Any Parent', 'parent-fitler') . '</option>';
        // Print the 0 option for showing only top level posts
        echo '<option value="0"' . ($request['selected'] === '0' ? ' selected="selected"' : '') . '>' . __('&mdash; None/Root &mdash;', 'parent-filter') . '</option>';
        // Print the queried items
        echo walk_page_dropdown_tree($query->posts, 0, $request);
        echo '</select>';
    }
}
コード例 #4
0
 /**
  * Show private pages in the "page for posts" dropdown
  * @param  string $output Dropdown markup
  * @param  array  $r      Arguments
  * @param  array  $pages  Default pages
  * @return string         New dropdown markup
  */
 public function pageForPostsDropdown($output, $r, $pages)
 {
     if ($r['name'] !== 'page_for_posts') {
         return $output;
     }
     $r['post_status'] = array('publish', 'private');
     $pages = get_pages($r);
     $class = '';
     if (!empty($r['class'])) {
         $class = " class='" . esc_attr($r['class']) . "'";
     }
     $output = "<select name='" . esc_attr($r['name']) . "'" . $class . " id='" . esc_attr($r['id']) . "'>\n";
     if ($r['show_option_no_change']) {
         $output .= "\t<option value=\"-1\">" . $r['show_option_no_change'] . "</option>\n";
     }
     if ($r['show_option_none']) {
         $output .= "\t<option value=\"" . esc_attr($r['option_none_value']) . '">' . $r['show_option_none'] . "</option>\n";
     }
     add_filter('list_pages', array($this, 'listPagesTitle'), 100, 2);
     $output .= walk_page_dropdown_tree($pages, $r['depth'], $r);
     remove_filter('list_pages', array($this, 'listPagesTitle'), 100);
     $output .= "</select>\n";
     return $output;
 }
コード例 #5
0
ファイル: theme-options.php プロジェクト: SayenkoDesign/ividf
function om_options_generator($options)
{
    $counter = 0;
    $menu = '';
    $output = '';
    foreach ($options as $value) {
        $counter++;
        $val = '';
        //Start Heading
        if ($value['type'] != "heading") {
            $output .= '<div class="om-options-section section-' . $value['type'] . '">';
            if (@$value['mode'] == 'toggle') {
                $output .= '<h3 class="heading"><a href="#" onclick="jQuery(\'#' . $value['id'] . '-container\').slideToggle(300);return false">' . $value['name'] . ' [+]</a></h3>';
                $output .= '<div class="option" id="' . $value['id'] . '-container" style="display:none"><div class="om-options-controls">';
            } else {
                $output .= '<h3 class="heading">' . $value['name'] . '</h3>';
                $output .= '<div class="option"><div class="om-options-controls">';
            }
        }
        //End Heading
        $select_value = '';
        switch ($value['type']) {
            case 'text':
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                $output .= '<input name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . esc_attr($val) . '" class="om-options-input" />';
                break;
            case 'select':
                $output .= '<select name="' . $value['id'] . '" id="' . $value['id'] . '" class="om-options-input">';
                $select_value = get_option($value['id']);
                foreach ($value['options'] as $option) {
                    $selected = '';
                    if ($select_value != '') {
                        if ($select_value == $option) {
                            $selected = ' selected="selected"';
                        }
                    } else {
                        if (isset($value['std'])) {
                            if ($value['std'] == $option) {
                                $selected = ' selected="selected"';
                            }
                        }
                    }
                    $output .= '<option' . $selected . '>' . $option . '</option>';
                }
                $output .= '</select>';
                break;
            case 'select-cat':
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                $args = array('show_option_all' => __('All Categories', 'om_theme'), 'show_option_none' => __('No Categories', 'om_theme'), 'hide_empty' => 0, 'echo' => 0, 'selected' => $val, 'hierarchical' => 0, 'name' => $value['id'], 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => 'category', 'hide_if_empty' => false);
                $output .= '<div class="om-options-input">' . wp_dropdown_categories($args) . '</div>';
                break;
            case 'select-page':
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                /*
                $args = array(
                	'selected'         => $val,
                	'echo'             => 0,
                	'name'             => $value['id'],
                	'show_option_none' => 'None (default)',
                	'option_none_value' => 0,
                );
                $output .= '<div class="om-options-input">'.wp_dropdown_pages( $args ).'</div>';
                */
                $args = array('post_type' => 'page', 'post_status' => 'publish,private,pending,draft');
                $arr = get_pages($args);
                $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => $val, 'echo' => 0);
                $r = wp_parse_args($args, $defaults);
                $output .= '<div class="om-options-input"><select name="' . $value['id'] . '"><option value="0">' . __('None (default)', 'om_theme') . '</option>';
                $output .= walk_page_dropdown_tree($arr, 0, $r);
                $output .= '</select></div>';
                break;
            case 'select-tax':
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                $args = array('show_option_all' => __('All', 'om_theme') . ' ' . $value['taxonomy'], 'show_option_none' => __('No', 'om_theme') . ' ' . $value['taxonomy'], 'hide_empty' => 0, 'echo' => 0, 'selected' => $val, 'hierarchical' => 0, 'name' => $value['id'], 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => $value['taxonomy'], 'hide_if_empty' => false);
                $output .= '<div class="om-options-input">' . @wp_dropdown_categories($args) . '</div>';
                break;
            case 'select2':
                $output .= '<select name="' . $value['id'] . '" id="' . $value['id'] . '" class="om-options-input">';
                $select_value = get_option($value['id']);
                foreach ($value['options'] as $option => $name) {
                    $selected = '';
                    if ($select_value != '') {
                        if ($select_value == $option) {
                            $selected = ' selected="selected"';
                        }
                    } else {
                        if (isset($value['std'])) {
                            if ($value['std'] == $option) {
                                $selected = ' selected="selected"';
                            }
                        }
                    }
                    $output .= '<option' . $selected . ' value="' . $option . '">' . $name . '</option>';
                }
                $output .= '</select>';
                break;
            case 'textarea':
                $rows = '8';
                $ta_value = '';
                if (isset($value['std'])) {
                    $ta_value = $value['std'];
                }
                $std = get_option($value['id']);
                if ($std != "") {
                    $ta_value = stripslashes($std);
                }
                if (isset($value['rows'])) {
                    $rows = $value['rows'];
                }
                $output .= '<textarea name="' . $value['id'] . '" id="' . $value['id'] . '" rows="' . $rows . '" class="om-options-input">' . esc_textarea($ta_value) . '</textarea>';
                break;
            case "radio":
                $select_value = get_option($value['id']);
                foreach ($value['options'] as $key => $option) {
                    $checked = '';
                    if ($select_value != '') {
                        if ($select_value == $key) {
                            $checked = ' checked';
                        }
                    } else {
                        if ($value['std'] == $key) {
                            $checked = ' checked';
                        }
                    }
                    $output .= '<label><input type="radio" name="' . $value['id'] . '" value="' . $key . '" ' . $checked . ' /> ' . $option . '</label><br />';
                }
                break;
            case "checkbox":
                $std = $value['std'];
                $saved_std = get_option($value['id']);
                $checked = '';
                if (!empty($saved_std)) {
                    if ($saved_std == 'true') {
                        $checked = 'checked="checked"';
                    } else {
                        $checked = '';
                    }
                } elseif ($std == 'true') {
                    $checked = 'checked="checked"';
                } else {
                    $checked = '';
                }
                $output .= '<input type="checkbox" name="' . $value['id'] . '" id="' . $value['id'] . '" value="true" ' . $checked . ' />';
                break;
            case "multicheck":
                $std = $value['std'];
                $saved_std = get_option($value['id']);
                foreach ($value['options'] as $key => $option) {
                    if (!empty($saved_std)) {
                        if ($saved_std[$key] == 'true') {
                            $checked = 'checked="checked"';
                        } else {
                            $checked = '';
                        }
                    } elseif ($std[$key] == 'true') {
                        $checked = 'checked="checked"';
                    } else {
                        $checked = '';
                    }
                    $output .= '<input type="checkbox" name="' . $value['id'] . '[' . $key . ']" id="' . $value['id'] . '_' . $key . '" value="true" ' . $checked . ' /><label for="' . $value['id'] . '_' . $key . '">' . $option . '</label><br />';
                }
                break;
            case "upload":
                $val = $value['std'];
                $std = get_option($value['id']);
                if ($std != "") {
                    $val = $std;
                }
                $strip_id = str_replace(']', '', str_replace('[', '_', $value['id']));
                $output .= '
					<input name="' . $value['id'] . '" id="' . $strip_id . '_input" type="text" value="' . esc_attr($val) . '" class="om-options-input" />
					<div class="upload_button_div">
						<span class="button input-browse-button" id="' . $strip_id . '" rel="' . $strip_id . '_input" data-mode="preview" data-base-id="' . $strip_id . '" data-library="image" data-choose="' . __('Choose a file', 'om_theme') . '" data-select="' . __('Select', 'om_theme') . '">Browse Image</span>
						<span class="button input-browse-button-remove" id="' . $strip_id . '_remove" data-base-id="' . $strip_id . '" title="">Remove</span>
					</div>
					<div class="clear"></div>
					<div class="om-option-image-preview" id="' . $strip_id . '_image">' . ($val ? '<a href="' . esc_url($val) . '" target="_blank"><img src="' . esc_url($val) . '" /></a>' : '') . '</div>
					<div class="clear"></div>
				';
                break;
            case "note":
                $output .= '<div class="notes"><p>' . $value['message'] . '</p></div>';
                break;
            case "intro":
                $output .= '<div class="intro"><p>' . $value['message'] . '</p></div>';
                break;
            case "subheader":
                $output .= '<div class="subheader"><p>' . $value['message'] . '</p></div>';
                break;
            case "color":
                $val = $value['std'];
                $stored = get_option($value['id']);
                if ($stored != "") {
                    $val = $stored;
                }
                //$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div></div></div>';
                //$output .= '<input class="om-option-color" name="'. $value['id'] .'" id="'. $value['id'] .'" type="text" value="'. $val .'" />';
                $output .= '<input class="wp-color-picker-field" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . esc_attr($val) . '" data-default-color="' . esc_attr($val) . '" />';
                break;
            case 'font':
                $stored = get_option($value['id']);
                if (!is_array($stored)) {
                    $stored = $value['std'];
                }
                $output .= __('Source:', 'om_theme') . ' <select name="' . $value['id'] . '[type]" id="' . $value['id'] . '" style="width:auto" onchange="jQuery(\'.om-font-' . $value['id'] . '-type-box\').hide();jQuery(\'#' . $value['id'] . '_container_\'+this.value).show()">';
                $output .= '<option value="standard"' . (@$stored['type'] == 'standard' ? ' selected="selected"' : '') . '>' . __('Standard fonts', 'om_theme') . '</option>';
                $output .= '<option value="google"' . (@$stored['type'] == 'google' ? ' selected="selected"' : '') . '>' . __('Google.Fonts', 'om_theme') . '</option>';
                $output .= '<option value="external"' . (@$stored['type'] == 'external' ? ' selected="selected"' : '') . '>' . __('Any external fonts (e.g. Typekit)', 'om_theme') . '</option>';
                $output .= '</select>';
                $output .= '<div id="' . $value['id'] . '_container_standard" class="om-font-' . $value['id'] . '-type-box"' . (@$stored['type'] == 'standard' || @$stored['type'] == '' ? '' : ' style="display:none"') . '>';
                $output .= __('Font family:', 'om_theme') . ' <select name="' . $value['id'] . '[standard][family]" id="' . $value['id'] . '_standard_family" style="width:auto">';
                foreach ($value['options'] as $option => $name) {
                    $output .= '<option value="' . $option . '"' . (@$stored['standard']['family'] == $option ? ' selected="selected"' : '') . '>' . $name . '</option>';
                }
                $output .= '</select>';
                $output .= '</div>';
                $output .= '<div id="' . $value['id'] . '_container_google" class="om-font-' . $value['id'] . '-type-box"' . (@$stored['type'] == 'google' ? '' : ' style="display:none"') . '>';
                $output .= __('Font name:', 'om_theme') . ' <input name="' . $value['id'] . '[google][family]" id="' . $value['id'] . '_google_family" type="text" value="' . esc_attr(@$stored['google']['family']) . '" style="width:250px" />';
                $output .= '<div class="om-options-note">' . __('Choose the the font from <a href="http://www.google.com/fonts" target="_blank">http://www.google.com/fonts</a> and enter the name.', 'om_theme') . '</div>';
                if (!isset($stored['google']['weight_normal'])) {
                    $stored['google']['weight_normal'] = 400;
                }
                $output .= __('Font weight for normal text:', 'om_theme') . ' <select name="' . $value['id'] . '[google][weight_normal]" id="' . $value['id'] . '_google_weight_normal" style="width:150px">
						<option value="100"' . (@$stored['google']['weight_normal'] == 100 ? ' selected="selected"' : '') . '>100</option>
						<option value="200"' . (@$stored['google']['weight_normal'] == 200 ? ' selected="selected"' : '') . '>200</option>
						<option value="300"' . (@$stored['google']['weight_normal'] == 300 ? ' selected="selected"' : '') . '>300</option>
						<option value="400"' . (@$stored['google']['weight_normal'] == 400 ? ' selected="selected"' : '') . '>400 (' . __('standard', 'om_theme') . ')</option>
						<option value="500"' . (@$stored['google']['weight_normal'] == 500 ? ' selected="selected"' : '') . '>500</option>
						<option value="600"' . (@$stored['google']['weight_normal'] == 600 ? ' selected="selected"' : '') . '>600</option>
						<option value="700"' . (@$stored['google']['weight_normal'] == 700 ? ' selected="selected"' : '') . '>700</option>
						<option value="800"' . (@$stored['google']['weight_normal'] == 800 ? ' selected="selected"' : '') . '>800</option>
						<option value="900"' . (@$stored['google']['weight_normal'] == 900 ? ' selected="selected"' : '') . '>900</option>
					</select>';
                if (!isset($stored['google']['weight_bold'])) {
                    $stored['google']['weight_bold'] = 700;
                }
                $output .= '<br/>' . __('Font weight for bold text:', 'om_theme') . ' <select name="' . $value['id'] . '[google][weight_bold]" id="' . $value['id'] . '_google_weight_bold" style="width:150px">
						<option value="100"' . (@$stored['google']['weight_bold'] == 100 ? ' selected="selected"' : '') . '>100</option>
						<option value="200"' . (@$stored['google']['weight_bold'] == 200 ? ' selected="selected"' : '') . '>200</option>
						<option value="300"' . (@$stored['google']['weight_bold'] == 300 ? ' selected="selected"' : '') . '>300</option>
						<option value="400"' . (@$stored['google']['weight_bold'] == 400 ? ' selected="selected"' : '') . '>400</option>
						<option value="500"' . (@$stored['google']['weight_bold'] == 500 ? ' selected="selected"' : '') . '>500</option>
						<option value="600"' . (@$stored['google']['weight_bold'] == 600 ? ' selected="selected"' : '') . '>600</option>
						<option value="700"' . (@$stored['google']['weight_bold'] == 700 ? ' selected="selected"' : '') . '>700 (' . __('standard', 'om_theme') . ')</option>
						<option value="800"' . (@$stored['google']['weight_bold'] == 800 ? ' selected="selected"' : '') . '>800</option>
						<option value="900"' . (@$stored['google']['weight_bold'] == 900 ? ' selected="selected"' : '') . '>900</option>
					</select>';
                $output .= '<div class="om-options-note">' . __('Please, make sure that chosen font supports chosen weight', 'om_theme') . '</div>';
                $output .= '<div style="padding-bottom:5px"><i>' . __('Latin charset by default. Include additional character sets for fonts (make sure at <a href="http://www.google.com/fonts/" target="_blank">http://www.google.com/fonts/</a> before that charset is available for chosen font):', 'om_theme') . '</i></div>';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][latin_ext]" value="true" ' . (@$stored['google']['latin_ext'] ? ' checked="checked"' : '') . ' /> ' . __('Latin Extended', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][arabic]" value="true" ' . (@$stored['google']['arabic'] ? ' checked="checked"' : '') . ' /> ' . __('Arabic', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][cyrillic]" value="true" ' . (@$stored['google']['cyrillic'] ? ' checked="checked"' : '') . ' /> ' . __('Cyrillic', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][cyrillic_ext]" value="true" ' . (@$stored['google']['cyrillic_ext'] ? ' checked="checked"' : '') . ' /> ' . __('Cyrillic Extended', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][devanagari]" value="true" ' . (@$stored['google']['devanagari'] ? ' checked="checked"' : '') . ' /> ' . __('Devanagari', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][greek]" value="true" ' . (@$stored['google']['greek'] ? ' checked="checked"' : '') . ' /> ' . __('Greek', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][greek_ext]" value="true" ' . (@$stored['google']['greek_ext'] ? ' checked="checked"' : '') . ' /> ' . __('Greek Extended', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][hebrew]" value="true" ' . (@$stored['google']['hebrew'] ? ' checked="checked"' : '') . ' /> ' . __('Hebrew', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][khmer]" value="true" ' . (@$stored['google']['khmer'] ? ' checked="checked"' : '') . ' /> ' . __('Khmer', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][telugu]" value="true" ' . (@$stored['google']['telugu'] ? ' checked="checked"' : '') . ' /> ' . __('Telugu', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][vietnamese]" value="true" ' . (@$stored['google']['vietnamese'] ? ' checked="checked"' : '') . ' /> ' . __('Vietnamese', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '</div>';
                $output .= '<div id="' . $value['id'] . '_container_external" class="om-font-' . $value['id'] . '-type-box"' . (@$stored['type'] == 'external' ? '' : ' style="display:none"') . '>';
                $output .= __('Embed code for the &lt;head&gt; section:', 'om_theme') . '<br/><textarea name="' . $value['id'] . '[external][embed]" id="' . $value['id'] . '_external_embed" rows="3" style="width:300px">' . esc_textarea(@$stored['external']['embed']) . '</textarea><br/>';
                $output .= __('Font family:', 'om_theme') . '<br/><input name="' . $value['id'] . '[external][family]" id="' . $value['id'] . '_external_family" type="text" value="' . esc_attr(@$stored['external']['family']) . '" style="width:300px" />';
                $output .= '<div class="om-options-note">' . __('Enter the value for "font-family" attribute, also you can specify the stack of the fonts', 'om_theme') . '</div>';
                $output .= '</div>';
                break;
            case 'font_full':
                $stored = get_option($value['id']);
                if (!is_array($stored)) {
                    $stored = $value['std'];
                }
                $output .= __('Source:', 'om_theme') . ' <select name="' . $value['id'] . '[type]" id="' . $value['id'] . '" style="width:auto" onchange="jQuery(\'.om-font-' . $value['id'] . '-type-box\').hide();jQuery(\'#' . $value['id'] . '_container_\'+this.value).show()">';
                $output .= '<option value="standard"' . (@$stored['type'] == 'standard' ? ' selected="selected"' : '') . '>' . __('Standard fonts', 'om_theme') . '</option>';
                $output .= '<option value="google"' . (@$stored['type'] == 'google' ? ' selected="selected"' : '') . '>' . __('Google.Fonts', 'om_theme') . '</option>';
                $output .= '<option value="external"' . (@$stored['type'] == 'external' ? ' selected="selected"' : '') . '>' . __('Any external fonts (e.g. Typekit)', 'om_theme') . '</option>';
                $output .= '</select>';
                $output .= '<div id="' . $value['id'] . '_container_standard" class="om-font-' . $value['id'] . '-type-box"' . (@$stored['type'] == 'standard' || @$stored['type'] == '' ? '' : ' style="display:none"') . '>';
                $output .= __('Font family:', 'om_theme') . ' <select name="' . $value['id'] . '[standard][family]" id="' . $value['id'] . '_standard_family" style="width:auto">';
                foreach ($value['options'] as $option => $name) {
                    $output .= '<option value="' . $option . '"' . (@$stored['standard']['family'] == $option ? ' selected="selected"' : '') . '>' . $name . '</option>';
                }
                $output .= '</select>';
                $output .= '</div>';
                $output .= '<div id="' . $value['id'] . '_container_google" class="om-font-' . $value['id'] . '-type-box"' . (@$stored['type'] == 'google' ? '' : ' style="display:none"') . '>';
                $output .= __('Font name:', 'om_theme') . ' <input name="' . $value['id'] . '[google][family]" id="' . $value['id'] . '_google_family" type="text" value="' . esc_attr(@$stored['google']['family']) . '" style="width:250px" />';
                $output .= '<div class="om-options-note" style="margin-top:-5px">' . __('Choose the the font from <a href="http://www.google.com/fonts/" target="_blank">http://www.google.com/fonts/</a> and enter the name.', 'om_theme') . '</div>';
                $output .= '<div style="padding-bottom:5px"><i>' . __('Latin charset by default. Include additional character sets for fonts (make sure at <a href="http://www.google.com/fonts/" target="_blank">http://www.google.com/fonts/</a> before that charset is available for chosen font):', 'om_theme') . '</i></div>';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][latin_ext]" value="true" ' . (@$stored['google']['latin_ext'] ? ' checked="checked"' : '') . ' /> ' . __('Latin Extended', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][arabic]" value="true" ' . (@$stored['google']['arabic'] ? ' checked="checked"' : '') . ' /> ' . __('Arabic', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][cyrillic]" value="true" ' . (@$stored['google']['cyrillic'] ? ' checked="checked"' : '') . ' /> ' . __('Cyrillic', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][cyrillic_ext]" value="true" ' . (@$stored['google']['cyrillic_ext'] ? ' checked="checked"' : '') . ' /> ' . __('Cyrillic Extended', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][devanagari]" value="true" ' . (@$stored['google']['devanagari'] ? ' checked="checked"' : '') . ' /> ' . __('Devanagari', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][greek]" value="true" ' . (@$stored['google']['greek'] ? ' checked="checked"' : '') . ' /> ' . __('Greek', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][greek_ext]" value="true" ' . (@$stored['google']['greek_ext'] ? ' checked="checked"' : '') . ' /> ' . __('Greek Extended', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][hebrew]" value="true" ' . (@$stored['google']['hebrew'] ? ' checked="checked"' : '') . ' /> ' . __('Hebrew', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][khmer]" value="true" ' . (@$stored['google']['khmer'] ? ' checked="checked"' : '') . ' /> ' . __('Khmer', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][telugu]" value="true" ' . (@$stored['google']['telugu'] ? ' checked="checked"' : '') . ' /> ' . __('Telugu', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '<label style="white-space:nowrap"><input type="checkbox" name="' . $value['id'] . '[google][vietnamese]" value="true" ' . (@$stored['google']['vietnamese'] ? ' checked="checked"' : '') . ' /> ' . __('Vietnamese', 'om_theme') . '</label> &nbsp;&nbsp; ';
                $output .= '</div>';
                $output .= '<div id="' . $value['id'] . '_container_external" class="om-font-' . $value['id'] . '-type-box"' . (@$stored['type'] == 'external' ? '' : ' style="display:none"') . '>';
                $output .= __('Embed code for the &lt;head&gt; section:', 'om_theme') . ' <textarea name="' . $value['id'] . '[external][embed]" id="' . $value['id'] . '_external_embed" rows="3" cols="8">' . esc_textarea(@$stored['external']['embed']) . '</textarea><br/>';
                $output .= __('Font family:', 'om_theme') . ' <input name="' . $value['id'] . '[external][family]" id="' . $value['id'] . '_external_family" type="text" value="' . esc_attr(@$stored['external']['family']) . '" style="width:220px" />';
                $output .= '<div class="om-options-note" style="margin-top:-5px">' . __('Enter the value for "font-family" attribute, also you can specify the stack of the fonts', 'om_theme') . '</div>';
                $output .= '</div>';
                $output .= __('Font size:', 'om_theme') . ' <select name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size" style="width:auto">';
                for ($i = 8; $i < 71; $i++) {
                    $output .= '<option value="' . $i . '" ' . (@$stored['size'] == $i ? ' selected="selected"' : '') . '>' . $i . 'px</option>';
                }
                $output .= '</select><br/>';
                $output .= __('Line height:', 'om_theme') . ' <select name="' . $value['id'] . '[lineheight]" id="' . $value['id'] . '_lineheight" style="width:auto">';
                for ($i = 1; $i <= 2; $i += 0.01) {
                    $output .= '<option value="' . $i . '" ' . (abs(@$stored['lineheight'] - $i) < 1.0E-5 ? ' selected="selected"' : '') . '>' . number_format($i, 2) . 'em</option>';
                }
                $output .= '</select>';
                break;
            case "images":
                $i = 0;
                $select_value = get_option($value['id']);
                foreach ($value['options'] as $key => $option) {
                    $i++;
                    $checked = '';
                    $selected = '';
                    if ($select_value != '') {
                        if ($select_value == $key) {
                            $checked = ' checked';
                            $selected = 'om-radio-img-selected';
                        }
                    } else {
                        if ($value['std'] == $key) {
                            $checked = ' checked';
                            $selected = 'om-radio-img-selected';
                        } elseif ($i == 1 && !isset($select_value)) {
                            $checked = ' checked';
                            $selected = 'om-radio-img-selected';
                        } elseif ($i == 1 && $value['std'] == '') {
                            $checked = ' checked';
                            $selected = 'om-radio-img-selected';
                        } else {
                            $checked = '';
                        }
                    }
                    $output .= '<span>';
                    $output .= '<input type="radio" id="om-radio-img-' . $value['id'] . $i . '" class="checkbox om-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                    $output .= '<div class="om-radio-img-label">' . $key . '</div>';
                    $output .= '<img src="' . esc_url($option) . '" alt="" class="om-radio-img-img ' . $selected . '" onClick="document.getElementById(\'om-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                    $output .= '</span>';
                }
                break;
            case "info":
                $default = $value['std'];
                $output .= $default;
                break;
            case "form_fields":
                $std = $value['std'];
                $saved_std = get_option($value['id']);
                if (!is_array($saved_std)) {
                    $saved_std = array();
                }
                for ($i = 0; $i < 10; $i++) {
                    $output .= __('<b>Field', 'om_theme') . ' ' . ($i + 1) . '</b><br/>';
                    $output .= __('Name:', 'om_theme') . ' <input type="text" name="' . $value['id'] . '[' . $i . '][name]" value="' . esc_attr(@$saved_std[$i]['name']) . '" /><br/>';
                    $output .= __('Type:', 'om_theme') . ' <select style="width:120px" name="' . $value['id'] . '[' . $i . '][type]"><option value="text">String</option><option value="email">Email</option><option value="textarea"' . (@$saved_std[$i]['type'] == 'textarea' ? ' selected="selected"' : '') . '>Textarea</option><option value="checkbox"' . (@$saved_std[$i]['type'] == 'checkbox' ? ' selected="selected"' : '') . '>Checkbox</option></select> &nbsp;&nbsp;&nbsp;';
                    $output .= __('Required:', 'om_theme') . ' <input type="checkbox" name="' . $value['id'] . '[' . $i . '][required]" ' . (@$saved_std[$i]['required'] ? ' checked="checked"' : '') . ' />';
                    $output .= '<br/><div style="border-bottom:1px dotted #aaa"></div><br/>';
                }
                break;
            case "styling_presets":
                $saved_std = get_option($value['id']);
                if (!is_array($saved_std)) {
                    $saved_std = array();
                }
                if (empty($saved_std)) {
                    $output .= '<i>' . __('No presets created yet.', 'om_theme') . '</i><br />';
                } else {
                    $output .= '<table border="0" cellpadding="10" cellspacing="0">';
                    foreach ($saved_std as $k => $v) {
                        $output .= '<tr>
							<td style="border-bottom:1px dotted #aaa"><b>' . esc_html($k) . '</b></td>
							<td style="border-bottom:1px dotted #aaa"><span class="button om-style-apply-button" id="' . $value['id'] . '_apply" data-optionid="' . $value['id'] . '" data-optionname="' . esc_attr($k) . '">' . __('Apply', 'om_theme') . '</span></td>
							<td style="border-bottom:1px dotted #aaa"><span class="button om-style-remove-button" id="' . $value['id'] . '_apply" data-optionid="' . $value['id'] . '" data-optionname="' . esc_attr($k) . '">' . __('Remove', 'om_theme') . '</span></td>
						</tr>';
                    }
                    $output .= '</table><br />';
                }
                $output .= '<br /><b>' . __('Save current styling options as new preset:', 'om_theme') . '</b><br/>Name: <input type="text" name="' . $value['id'] . '_new" style="width:60%" /> <span class="button " id="om-styling-button-save">' . __('Save', 'om_theme') . '</span> <br />';
                break;
            case "heading":
                if ($counter >= 2) {
                    $output .= '</div>' . "\n";
                }
                $jquery_click_hook = preg_replace("/[^A-Za-z0-9]/", "", strtolower($value['name']));
                $jquery_click_hook = "om-option-section-" . $jquery_click_hook;
                $menu .= '<li><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                break;
        }
        if ($value['type'] != "heading") {
            if ($value['type'] != "checkbox") {
                $output .= '<br/>';
            }
            if (!isset($value['desc'])) {
                $explain_value = '';
            } else {
                $explain_value = $value['desc'];
            }
            $output .= '</div><div class="om-options-explain">' . $explain_value . '</div>';
            $output .= '<div class="clear"> </div></div></div>';
        }
        if (isset($value['code'])) {
            $output .= $value['code'];
        }
    }
    $output .= '</div>';
    return array('options' => $output, 'menu' => $menu);
}
コード例 #6
0
 private function show_posts_dropdown($post_type, $name, $selected = 0)
 {
     if ($post_type == 'ddl-all-post-types') {
         $post_type = 'any';
     }
     $attr = array('name' => $name, 'post_type' => $post_type, 'show_option_none' => __('None', 'ddl-layouts'), 'selected' => $selected);
     add_filter('posts_clauses_request', array($this, 'posts_clauses_request_filter'), 10, 2);
     $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => $selected, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
     $r = wp_parse_args($attr, $defaults);
     extract($r, EXTR_SKIP);
     $pages = get_posts(array('posts_per_page' => -1, 'post_type' => $post_type, 'suppress_filters' => false));
     $output = '';
     // 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='" . esc_attr($name) . "' id='" . esc_attr($id) . "' data-post-type='" . esc_attr($post_type) . "'>\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";
     }
     echo $output;
     remove_filter('posts_clauses_request', array($this, 'posts_clauses_request_filter'), 10, 2);
 }
コード例 #7
0
ファイル: functions.php プロジェクト: TheRandumbGuy1/Website
function admin_private_parent_metabox($output)
{
    global $post;
    $args = array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column' => 'menu_order, post_title', 'echo' => 0, 'post_status' => array('publish', 'private'));
    $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $pages = get_pages($r);
    $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}\">\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";
    }
    return $output;
}
コード例 #8
0
/**
 * Output a select box allowing to pick which forum/topic a new
 * topic/reply belongs in.
 *
 * @since bbPress (r2746)
 *
 * @param mixed $args The function supports these args:
 *  - post_type: Post type, defaults to bbp_get_forum_post_type() (bbp_forum)
 *  - selected: Selected ID, to not have any value as selected, pass
 *               anything smaller than 0 (due to the nature of select
 *               box, the first value would of course be selected -
 *               though you can have that as none (pass 'show_none' arg))
 *  - orderby: Defaults to 'menu_order title'
 *  - post_parent: Post parent. Defaults to 0
 *  - post_status: Which all post_statuses to find in? Can be an array
 *                  or CSV of publish, category, closed, private, spam,
 *                  trash (based on post type) - if not set, these are
 *                  automatically determined based on the post_type
 *  - posts_per_page: Retrieve all forums/topics. Defaults to -1 to get
 *                     all posts
 *  - walker: Which walker to use? Defaults to
 *             {@link BBP_Walker_Dropdown}
 *  - select_id: ID of the select box. Defaults to 'bbp_forum_id'
 *  - tab: Tabindex value. False or integer
 *  - options_only: Show only <options>? No <select>?
 *  - show_none: False or something like __( '(No Forum)', 'bbpress' ),
 *                will have value=""
 *  - none_found: False or something like
 *                 __( 'No forums to post to!', 'bbpress' )
 *  - disable_categories: Disable forum categories and closed forums?
 *                         Defaults to true. Only for forums and when
 *                         the category option is displayed.
 * @uses BBP_Walker_Dropdown() As the default walker to generate the
 *                              dropdown
 * @uses current_user_can() To check if the current user can read
 *                           private forums
 * @uses bbp_get_forum_post_type() To get the forum post type
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses walk_page_dropdown_tree() To generate the dropdown using the
 *                                  walker
 * @uses apply_filters() Calls 'bbp_get_dropdown' with the dropdown
 *                        and args
 * @return string The dropdown
 */
function stachestack_bbp_get_dropdown($args = '')
{
    /** Arguments *********************************************************/
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('post_type' => bbp_get_forum_post_type(), 'post_parent' => null, 'post_status' => null, 'selected' => 0, 'exclude' => array(), 'numberposts' => -1, 'orderby' => 'menu_order title', 'order' => 'ASC', 'walker' => '', 'select_id' => 'bbp_forum_id', 'tab' => bbp_get_tab_index(), 'options_only' => false, 'show_none' => false, 'none_found' => false, 'disable_categories' => true, 'disabled' => ''), 'get_dropdown');
    if (empty($r['walker'])) {
        $r['walker'] = new BBP_Walker_Dropdown();
        $r['walker']->tree_type = $r['post_type'];
    }
    // Force 0
    if (is_numeric($r['selected']) && $r['selected'] < 0) {
        $r['selected'] = 0;
    }
    // Force array
    if (!empty($r['exclude']) && !is_array($r['exclude'])) {
        $r['exclude'] = explode(',', $r['exclude']);
    }
    /** Setup variables ***************************************************/
    $retval = '';
    $posts = get_posts(array('post_type' => $r['post_type'], 'post_status' => $r['post_status'], 'exclude' => $r['exclude'], 'post_parent' => $r['post_parent'], 'numberposts' => $r['numberposts'], 'orderby' => $r['orderby'], 'order' => $r['order'], 'walker' => $r['walker'], 'disable_categories' => $r['disable_categories']));
    /** Drop Down *********************************************************/
    // Items found
    if (!empty($posts)) {
        // Build the opening tag for the select element
        if (empty($r['options_only'])) {
            // Should this select appear disabled?
            $disabled = disabled(isset(bbpress()->options[$r['disabled']]), true, false);
            // Setup the tab index attribute
            $tab = !empty($r['tab']) ? ' tabindex="' . intval($r['tab']) . '"' : '';
            // Build the opening tag
            $retval .= '<select class="form-control" name="' . esc_attr($r['select_id']) . '" id="' . esc_attr($r['select_id']) . '"' . $disabled . $tab . '>' . "\n";
        }
        // Get the options
        $retval .= !empty($r['show_none']) ? "\t<option value=\"\" class=\"level-0\">" . esc_html($r['show_none']) . '</option>' : '';
        $retval .= walk_page_dropdown_tree($posts, 0, $r);
        // Build the closing tag for the select element
        if (empty($r['options_only'])) {
            $retval .= '</select>';
        }
        // No items found - Display feedback if no custom message was passed
    } elseif (empty($r['none_found'])) {
        // Switch the response based on post type
        switch ($r['post_type']) {
            // Topics
            case bbp_get_topic_post_type():
                $retval = __('No topics available', 'bbpress');
                break;
                // Forums
            // Forums
            case bbp_get_forum_post_type():
                $retval = __('No forums available', 'bbpress');
                break;
                // Any other
            // Any other
            default:
                $retval = __('None available', 'bbpress');
                break;
        }
    }
    return apply_filters('bbp_get_dropdown', $retval, $r);
}
コード例 #9
0
/**
 * Output a select box allowing to pick which forum/topic a new
 * topic/reply belongs in.
 *
 * @since bbPress (r2746)
 *
 * @param mixed $args The function supports these args:
 *  - post_type: Post type, defaults to bbp_get_forum_post_type() (bbp_forum)
 *  - selected: Selected ID, to not have any value as selected, pass
 *               anything smaller than 0 (due to the nature of select
 *               box, the first value would of course be selected -
 *               though you can have that as none (pass 'show_none' arg))
 *  - sort_column: Sort by? Defaults to 'menu_order, post_title'
 *  - child_of: Child of. Defaults to 0
 *  - post_status: Which all post_statuses to find in? Can be an array
 *                  or CSV of publish, category, closed, private, spam,
 *                  trash (based on post type) - if not set, these are
 *                  automatically determined based on the post_type
 *  - posts_per_page: Retrieve all forums/topics. Defaults to -1 to get
 *                     all posts
 *  - walker: Which walker to use? Defaults to
 *             {@link BBP_Walker_Dropdown}
 *  - select_id: ID of the select box. Defaults to 'bbp_forum_id'
 *  - tab: Tabindex value. False or integer
 *  - options_only: Show only <options>? No <select>?
 *  - show_none: False or something like __( '(No Forum)', 'bbpress' ),
 *                will have value=""
 *  - none_found: False or something like
 *                 __( 'No forums to post to!', 'bbpress' )
 *  - disable_categories: Disable forum categories and closed forums?
 *                         Defaults to true. Only for forums and when
 *                         the category option is displayed.
 * @uses BBP_Walker_Dropdown() As the default walker to generate the
 *                              dropdown
 * @uses current_user_can() To check if the current user can read
 *                           private forums
 * @uses bbp_get_forum_post_type() To get the forum post type
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses walk_page_dropdown_tree() To generate the dropdown using the
 *                                  walker
 * @uses apply_filters() Calls 'bbp_get_dropdown' with the dropdown
 *                        and args
 * @return string The dropdown
 */
function bbp_get_dropdown($args = '')
{
    /** Arguments *********************************************************/
    $defaults = array('post_type' => bbp_get_forum_post_type(), 'selected' => 0, 'sort_column' => 'menu_order', 'child_of' => '0', 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'walker' => '', 'select_id' => 'bbp_forum_id', 'tab' => bbp_get_tab_index(), 'options_only' => false, 'show_none' => false, 'none_found' => false, 'disable_categories' => true);
    $r = bbp_parse_args($args, $defaults, 'get_dropdown');
    if (empty($r['walker'])) {
        $r['walker'] = new BBP_Walker_Dropdown();
        $r['walker']->tree_type = $r['post_type'];
    }
    // Force 0
    if (is_numeric($r['selected']) && $r['selected'] < 0) {
        $r['selected'] = 0;
    }
    extract($r);
    // Unset the args not needed for WP_Query to avoid any possible conflicts.
    // Note: walker and disable_categories are not unset
    unset($r['select_id'], $r['tab'], $r['options_only'], $r['show_none'], $r['none_found']);
    /** Post Status *******************************************************/
    // Define local variable(s)
    $post_stati = array();
    // Public
    $post_stati[] = bbp_get_public_status_id();
    // Forums
    if (bbp_get_forum_post_type() == $post_type) {
        // Private forums
        if (current_user_can('read_private_forums')) {
            $post_stati[] = bbp_get_private_status_id();
        }
        // Hidden forums
        if (current_user_can('read_hidden_forums')) {
            $post_stati[] = bbp_get_hidden_status_id();
        }
    }
    // Setup the post statuses
    $r['post_status'] = implode(',', $post_stati);
    /** Setup variables ***************************************************/
    $name = esc_attr($select_id);
    $select_id = $name;
    $tab = (int) $tab;
    $retval = '';
    $posts = get_posts($r);
    /** Drop Down *********************************************************/
    // Items found
    if (!empty($posts)) {
        if (empty($options_only)) {
            $tab = !empty($tab) ? ' tabindex="' . $tab . '"' : '';
            $retval .= '<select name="' . $name . '" id="' . $select_id . '"' . $tab . '>' . "\n";
        }
        $retval .= !empty($show_none) ? "\t<option value=\"\" class=\"level-0\">" . $show_none . '</option>' : '';
        $retval .= walk_page_dropdown_tree($posts, 0, $r);
        if (empty($options_only)) {
            $retval .= '</select>';
        }
        // No items found - Display feedback if no custom message was passed
    } elseif (empty($none_found)) {
        // Switch the response based on post type
        switch ($post_type) {
            // Topics
            case bbp_get_topic_post_type():
                $retval = __('No topics available', 'bbpress');
                break;
                // Forums
            // Forums
            case bbp_get_forum_post_type():
                $retval = __('No forums available', 'bbpress');
                break;
                // Any other
            // Any other
            default:
                $retval = __('None available', 'bbpress');
                break;
        }
    }
    return apply_filters('bbp_get_dropdown', $retval, $args);
}
コード例 #10
0
_e('Schedule Meta', 'bpsp');
?>
</h4>
        <ul class="courseware-meta">
            <li id="edit-schedule-lecture">
                <label for="schedule-lecture"><?php 
_e('Linked Lecture', 'bpsp');
?>
</label>
                <select id="schedule-lecture" name="schedule[lecture_id]">
                    <option value=""><?php 
_e('Select Lecture', 'bpsp');
?>
</option>
                    <?php 
echo walk_page_dropdown_tree($lectures, 0, array('echo' => 1, 'depth' => 0, 'child_of' => 0, 'selected' => $lecture_id, 'post_type' => 'lecture', 'sort_column' => 'menu_order, post_title'));
?>
                </select>
            </li>
            <li id="schedule-start-date">
                <label for="schedule-startdate"><?php 
_e('Start date', 'bpsp');
?>
</label>
                    <input type="text" id="schedule-startdate" name="schedule[start_date]" title="<?php 
_e('Start date', 'bpsp');
?>
" value="<?php 
echo $schedule->start_date;
?>
" />
コード例 #11
0
ファイル: generic.php プロジェクト: sbhambad/TimousDemo
 /**
  * Retrieve or display list of posts as a dropdown (select list).
  *
  * @since 2.1.0
  *
  * @param array|string $args Optional. Override default arguments.
  * @param string $name Optional. Name of the select box.
  * @return string HTML content, if not displaying.
  */
 function wp_dropdown_posts($args = '', $name = 'post_id')
 {
     $defaults = array('depth' => 0, 'post_parent' => 0, 'selected' => 0, 'echo' => 1, 'id' => '', 'class' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '', 'post_type' => 'post', 'post_status' => 'publish', 'suppress_filters' => false, 'numberposts' => -1, 'select_even_if_empty' => false);
     $r = wp_parse_args($args, $defaults);
     extract($r, EXTR_SKIP);
     $hierarchical_post_types = get_post_types(array('hierarchical' => true));
     if (in_array($r['post_type'], $hierarchical_post_types)) {
         $pages = get_pages($r);
     } else {
         $pages = get_posts($r);
     }
     $output = '';
     // Back-compat with old system where both id and name were based on $name argument
     if (empty($id)) {
         $id = $name;
     }
     if (!empty($pages) || $select_even_if_empty == true) {
         $output = "<select name='" . esc_attr($name) . "' id='" . esc_attr($id) . "' class='" . esc_attr($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";
         }
         if (!empty($pages)) {
             $output .= walk_page_dropdown_tree($pages, $depth, $r);
         }
         $output .= "</select>\n";
     }
     $output = apply_filters('wp_dropdown_posts', $output, $name, $r);
     if ($echo) {
         echo $output;
     }
     return $output;
 }
コード例 #12
0
        // move the current post on top of the list
        foreach ($posts as $key => $post) {
            if ($post->ID == $selected->ID) {
                unset($posts[$key]);
            }
        }
        array_unshift($posts, $selected);
        $link = $this->edit_translation_link($value);
    } else {
        $link = $this->add_new_translation_link($post_ID, $post_type, $language);
    }
    ?>

		<tr>
			<td class = "pll-language-column"><?php 
    echo $language->flag ? $language->flag : esc_html($language->slug);
    ?>
</td>
			<td class = "pll-edit-column"><?php 
    echo $link;
    ?>
</td>
			<td class = "pll-translation-column"><?php 
    printf('<select name="post_tr_lang[%1$s]" id="tr_lang_%1$s" class="tags-input"><option value="">%2$s</option>%3$s</select>', esc_attr($language->slug), __('None'), walk_page_dropdown_tree($posts, 0, array('selected' => $value)));
    ?>
			</td>
		</tr><?php 
}
?>
</table>
コード例 #13
0
/**
 * Enable Page Blox to be selected for home page -------------------------------------------------------------
 */
function k_blox_to_dropdown($select)
{
    // Not our list.
    if (FALSE === strpos($select, 'page_on_front')) {
        return $select;
    }
    $blox = get_posts(array('post_type' => 'hom_page', 'post_status' => 'publish', 'posts_per_page' => -1));
    if (!$blox) {
        return $select;
    }
    $page_on_front = intval(get_option('page_on_front')) ? get_option('page_on_front') : -1;
    $blox_options = walk_page_dropdown_tree($blox, 0, array('depth' => 0, 'child_of' => 0, 'selected' => $page_on_front, 'echo' => 0, 'name' => 'page_on_front', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => ''));
    return str_replace('</select>', $blox_options . '</select>', $select);
}
コード例 #14
0
 /**
  * displays a multidropdown
  */
 function wt_multidropdown($get_options)
 {
     if (isset($get_options['target'])) {
         if (isset($get_options['options'])) {
             $get_options['options'] = $get_options['options'] + $this->wt_get_select_target_options($get_options['target']);
         } else {
             $get_options['options'] = $this->wt_get_select_target_options($get_options['target']);
         }
     }
     if (isset($this->saved_options[$get_options['id']])) {
         $selected_keys = $this->saved_options[$get_options['id']];
     } else {
         $selected_keys = $get_options['default'];
     }
     if (isset($get_options['row_class'])) {
         $row_class = ' class="' . $get_options['row_class'] . '"';
     } else {
         $row_class = '';
     }
     echo '<tr' . $row_class . '><th scope="row"><h4>' . $get_options['name'] . '</h4></th><td>';
     echo '<input type="hidden" id="' . $get_options['id'] . '" name="' . $get_options['id'] . '" value="' . implode(',', $selected_keys) . '"/>';
     echo '<div class="multidropdown-wrap">';
     $i = 0;
     if (isset($get_options['page'])) {
         $depth = $get_options['page'];
         $pages = get_pages();
     }
     foreach ($selected_keys as $selected) {
         echo '<select name="' . $get_options['id'] . '_' . $i . '" id="' . $get_options['id'] . '_' . $i . '">';
         if (isset($get_options['prompt'])) {
             echo '<option value="">' . $get_options['prompt'] . '</option>';
         }
         if (isset($get_options['options'])) {
             foreach ($get_options['options'] as $key => $option) {
                 echo '<option value="' . $key . '"';
                 if ($selected == $key) {
                     echo ' selected="selected"';
                 }
                 echo '>' . $option . '</option>';
             }
         }
         if (isset($get_options['page'])) {
             $args = array('depth' => $depth, 'child_of' => 0, 'selected' => $selected, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
             echo walk_page_dropdown_tree($pages, $depth, $args);
         }
         $i++;
         echo '</select>';
     }
     echo '<select name="' . $get_options['id'] . '_' . $i . '" id="' . $get_options['id'] . '_' . $i . '">';
     if (isset($get_options['prompt'])) {
         echo '<option value="">' . $get_options['prompt'] . '</option>';
     }
     if (isset($get_options['options'])) {
         foreach ($get_options['options'] as $key => $option) {
             echo '<option value="' . $key . '">' . $option . '</option>';
         }
     }
     if (isset($get_options['page'])) {
         $args = array('depth' => $depth, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
         echo walk_page_dropdown_tree($pages, $depth, $args);
     }
     echo '</select>';
     if (isset($get_options['desc'])) {
         echo '<div class="option_help"><a class="desc_help"><img src="' . THEME_ADMIN_ASSETS_URI . '/images/help_description.png"  alt="Description Info" /></a>';
         echo '<div class="tooltip">' . $get_options['desc'] . '</div></div></br>';
     }
     echo '</div></td></tr>';
 }
コード例 #15
0
            ?>
</strong> <?php 
            _e('You\'ve selected custom registration but have not selected a page to use. No one will be able to register for your site until you fix this.', 'join-my-multisite');
            ?>
</p></div>
                        <?php 
        }
        ?>
                        
                        <p><select name="jmm_perpage" id='jmm_options[perpage]'>
                            <option value="0"><?php 
        _e('&mdash; Select &mdash;');
        ?>
</option>
                            <?php 
        echo walk_page_dropdown_tree($all_pages, 0, array('depth' => 1, 'selected' => $jmm_options['perpage']));
        ?>
                        </select></p>
                        </td>
                        
                        <td><p class="description"><?php 
        _e('Users who are not logged in will be redirected to the perpage you select from the dropdowns. Only top-level pages may be used. Use the following shortcode to display the login form:', 'join-my-multisite');
        ?>
<br />
                            <code>[join-my-multisite]</code>
                        </td>
                    </tr>
                    <?php 
    }
}
// End check for if registration is on for the network.
コード例 #16
0
/**
 * Retrieve or display list of pages as a dropdown (select list).
 *
 * @since 2.1.0
 *
 * @param array|string $args Optional. Override default arguments.
 * @return string HTML content, if not displaying.
 */
function wp_dropdown_pages($args = '') {
	$defaults = array(
		'depth' => 0, 'child_of' => 0,
		'selected' => 0, 'echo' => 1,
		'name' => 'page_id', 'id' => '',
		'show_option_none' => '', 'show_option_no_change' => '',
		'option_none_value' => ''
	);

	$r = wp_parse_args( $args, $defaults );
	extract( $r, EXTR_SKIP );

	$pages = get_pages($r);
	$output = '';
	// 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='" . esc_attr( $name ) . "' id='" . esc_attr( $id ) . "'>\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";
	}

	/**
	 * Filter the HTML output of a list of pages as a drop down.
	 *
	 * @since 2.1.0
	 *
	 * @param string $output HTML output for drop down list of pages.
	 */
	$output = apply_filters( 'wp_dropdown_pages', $output );

	if ( $echo )
		echo $output;

	return $output;
}
コード例 #17
0
function wp_dropdown_pages($args = '') {
	if ( is_array($args) )
		$r = &$args;
	else
		parse_str($args, $r);

	$defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1,
		'name' => 'page_id', 'show_option_none' => '');
	$r = array_merge($defaults, $r);
	extract($r);

	$pages = get_pages($r);
	$output = '';

	if ( ! empty($pages) ) {
		$output = "<select name='$name'>\n";
		if ( $show_option_none )
			$output .= "\t<option value=''>$show_option_none</option>\n";
		$output .= walk_page_dropdown_tree($pages, $depth, $r);
		$output .= "</select>\n";
	}

	$output = apply_filters('wp_dropdown_pages', $output);

	if ( $echo )
		echo $output;

	return $output;
}
コード例 #18
0
/**
 * Retrieve or display list of pages as a dropdown (select list).
 *
 * @since 2.1.0
 *
 * @param array|string $args Optional. Override default arguments.
 * @return string HTML content, if not displaying.
 */
function wp_dropdown_pages($args = '') {
	$defaults = array(
		'depth' => 0, 'child_of' => 0,
		'selected' => 0, 'echo' => 1,
		'name' => 'page_id', 'show_option_none' => '', 'show_option_no_change' => '',
		'option_none_value' => ''
	);

	$r = wp_parse_args( $args, $defaults );
	extract( $r, EXTR_SKIP );

	$pages = get_pages($r);
	$output = '';

	if ( ! empty($pages) ) {
		$output = "<select name=\"$name\" id=\"$name\">\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('wp_dropdown_pages', $output);

	if ( $echo )
		echo $output;

	return $output;
}
コード例 #19
0
/**
 * Retrieve or display list of pages as a dropdown (select list).
 *
 * @since 2.1.0
 *
 * @param array|string $args Optional. Override default arguments.
 * @return string HTML content, if not displaying.
 */
function wp_dropdown_pages($args = '')
{
    $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $pages = get_pages($r);
    $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}\">\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('wp_dropdown_pages', $output);
    if ($echo) {
        echo $output;
    }
    return $output;
}
コード例 #20
0
ファイル: functions.php プロジェクト: gpreets/newlab
function msc_attsConfigFields($args)
{
    global $phpincludes;
    if (empty($args['elementID']) || empty($args['key'])) {
        return 'Need to define the element and key.';
    }
    $Element = get_option($args['elementID']);
    $argDefault = array('elementID' => '', 'key' => '', 'id' => $Element['_variable'][$args['key']], 'name' => $Element['_variable'][$args['key']], 'default' => trim($Element['_variableDefault'][$args['key']]), 'duplicate' => false);
    $args = wp_parse_args($args, $argDefault);
    $class = 'itemRow';
    if (!empty($Dup)) {
        $class = '';
    }
    if (empty($Element)) {
        return 'Element ID "' . $args['elementID'] . '" is invalid.';
    }
    $Return = '<tr valign="top" class="' . $class . '"><th scope="row"><label for="' . $args['id'] . '">' . $Element['_label'][$args['key']] . '</label></th>';
    $Return .= '  <td>';
    switch ($Element['_type'][$args['key']]) {
        case 'Dropdown':
            $options = explode(',', $Element['_variableDefault'][$args['key']]);
            $Return .= '<select name="' . $args['name'] . '" class="regular-text" ref="' . $args['id'] . '" id="field_' . $args['id'] . '">';
            $Return .= '<option value=""></option>';
            foreach ($options as $option) {
                $sel = '';
                if (strpos($option, '*') !== false && $args['default'] == $Element['_variableDefault'][$args['key']]) {
                    $sel = 'selected="selected"';
                }
                $option = str_replace('*', '', $option);
                if ($option == $args['default']) {
                    $sel = 'selected="selected"';
                }
                $Return .= '<option value="' . $option . '" ' . $sel . '>' . ucwords($option) . '</option>';
            }
            $Return .= '</select>';
            break;
        case 'Checkbox':
            $options = explode(',', $Element['_variableDefault'][$args['key']]);
            foreach ($options as $key => $option) {
                $idin = uniqid();
                $sel = '';
                if (strpos($option, '*') !== false && $args['default'] == $Element['_variableDefault'][$args['key']]) {
                    $sel = 'checked="checked"';
                }
                $option = str_replace('*', '', $option);
                $label = ucwords($option);
                if (strpos($option, ';') !== false) {
                    $opts = explode(';', $option);
                    $option = $opts[0];
                    $lable = $opts[1];
                }
                if ($option == $args['default']) {
                    $sel = 'checked="checked"';
                }
                $Return .= '<label for="' . $args['id'] . '_' . $idin . '">';
                $Return .= '<input type="checkbox" value="' . $option . '" id="' . $args['id'] . '_' . $idin . '" name="' . $args['name'] . '" ' . $sel . '/> ';
                $Return .= $label . '</label><br />';
            }
            break;
        case 'Radio':
            $options = explode(',', $Element['_variableDefault'][$args['key']]);
            foreach ($options as $key => $option) {
                $idin = uniqid();
                $sel = '';
                if (strpos($option, '*') !== false && $args['default'] == $Element['_variableDefault'][$args['key']]) {
                    $sel = 'checked="checked"';
                }
                $option = str_replace('*', '', $option);
                $label = ucwords($option);
                if (strpos($option, ';') !== false) {
                    $opts = explode(';', $option);
                    $option = $opts[0];
                    $lable = $opts[1];
                }
                if ($option == $args['default']) {
                    $sel = 'checked="checked"';
                }
                $Return .= '<label for="' . $args['id'] . '_' . $idin . '">';
                $Return .= '<input type="radio" value="' . $option . '" id="' . $args['id'] . '_' . $idin . '" name="' . $args['name'] . '" ' . $sel . '/> ';
                $Return .= $label . '</label><br />';
            }
            break;
        case 'Color Picker':
            $Return .= '<input name="' . $args['name'] . '" class="small-text minicolorPicker" type="text" ref="' . $args['id'] . '" id="' . $args['id'] . '" value="' . $args['default'] . '" style="width:115px;"/><a href="#" style="background-color: ' . $args['default'] . '" class="miniColors-trigger miniColors-trigger-fake"></a>';
            break;
        case 'Text':
        case 'Text Field':
            $Return .= '<input name="' . $args['name'] . '" class="regular-text" type="text" ref="' . $args['id'] . '" id="' . $args['id'] . '" value="' . $args['default'] . '"/>';
            break;
        case 'Text Box':
            $Return .= '<textarea name="' . $args['name'] . '" class="large-text" rows="5" type="text" id="' . $args['id'] . '" ref="' . $args['id'] . '">' . htmlspecialchars($args['default']) . '</textarea>';
            break;
        case 'File':
            $Return .= '<input name="' . $args['name'] . '" type="text" class="regular-text" ref="' . $args['id'] . '" id="' . $args['id'] . '" value="' . $args['default'] . '" />';
            $Return .= '<div id="uploader_' . $args['id'] . '" class="fbtn msc_uploader" style="float:none; display:inline;">';
            $Return .= '  <div class="button addFile" style="padding:2px 2px 1px; margin-bottom: 5px; font-weight:normal;">';
            $Return .= '      <i class="icon-file" style="margin-top:-1px;"></i><span> Select File</span>';
            $Return .= '  </div>';
            $Return .= '</div>';
            break;
        case 'Page Selector':
        case 'Page':
            $pageargs = array('depth' => 0, 'child_of' => 0, 'selected' => $args['default'], 'echo' => 0, 'name' => $args['name'], 'id' => $args['id'], 'class' => 'attrVal', 'post_type' => 'page');
            $pageArgsDefault = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
            $r = wp_parse_args($pageargs, $pageArgsDefault);
            extract($r, EXTR_SKIP);
            $pages = get_pages($r);
            $output = '';
            if (empty($id)) {
                $id = $name;
            }
            if (!empty($pages)) {
                $output = "<select name='" . esc_attr($name) . "' class='" . esc_attr($class) . "' id='" . esc_attr($id) . "'>\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";
            }
            $Return .= apply_filters('wp_dropdown_pages', $output);
            break;
        case 'Custom':
            //msc_formField($Element, $Type, $Title, $ID, $Name, $Default = false, $Dup = false, $isFirst = false, $caption = false);
            $Custom = explode(',', $argDefault['default']);
            $func = $Custom[0];
            if ($args['default'] == $argDefault['default']) {
                if (!empty($Custom[1])) {
                    $args['default'] = $Custom[1];
                } else {
                    $args['default'] = '';
                }
            }
            if (!empty($Element['_phpCode'])) {
                if (empty($phpincludes[$Element['_ID']])) {
                    eval($Element['_phpCode']);
                    $phpincludes[$Element['_ID']] = true;
                }
            }
            $Return .= $func($args);
            break;
    }
    if (!empty($args['duplicate'])) {
        $Return .= '<div id="remover_' . $args['id'] . '" class="fbtn remover" style="float:none; display:inline;">';
        $Return .= '  <div class="button button-small removeRow">';
        $Return .= '      <i class="icon-remove-sign" style="margin-top:1px;"></i><span> Remove</span>';
        $Return .= '  </div>';
        $Return .= '</div>';
    }
    if (!empty($Element['_variableInfo'][$args['key']])) {
        $Return .= '<p class="description">' . $Element['_variableInfo'][$args['key']] . '</p>';
    }
    $Return .= '  </td>';
    $Return .= '</tr>';
    return $Return;
}
コード例 #21
0
ファイル: CMB2_Types.php プロジェクト: acamboy/kutetheme-wp
 public function page_select()
 {
     $saved_term = is_wp_error($this->field->value) || empty($this->field->value) ? $this->field->args('default') : $this->field->value;
     $options = '';
     $option_none = $this->field->args('show_option_none');
     $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'class' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '', 'value_field' => 'ID');
     $defaults['selected'] = $saved_term;
     $r = wp_parse_args($this->field->args, $defaults);
     $pages = get_pages($r);
     // Back-compat with old system where both id and name were based on $name argument
     if (empty($r['id'])) {
         $r['id'] = $r['name'];
     }
     if (!empty($option_none)) {
         $option_none_value = apply_filters('cmb2_page_select_default_value', '');
         $option_none_value = apply_filters("cmb2_page_select_{$this->_id()}_default_value", $option_none_value);
         $options .= $this->select_option(array('label' => $option_none, 'value' => $option_none_value, 'checked' => $saved_term == $option_none_value));
     }
     if (!empty($pages)) {
         $options .= walk_page_dropdown_tree($pages, $r['depth'], $r);
     }
     return $this->select(array('options' => $options));
 }
コード例 #22
0
				<option value="0"><?php 
        _e('&mdash; Select &mdash;');
        ?>
</option>
				<?php 
        if (current_user_can('create_posts', 'page')) {
            ?>
				<option value="new" id="new-page"><?php 
            _e('&mdash; Add new page &mdash;');
            ?>
</option>
				<?php 
        }
        ?>
				<?php 
        echo walk_page_dropdown_tree($all_pages, 0, array('selected' => get_option('page_on_front')));
        ?>
			</select>
		</label>
		<?php 
        if (current_user_can('create_posts', 'page')) {
            ?>
		<label for="page_on_front_title" class="if-new-front-page"><?php 
            _e('titled:');
            ?>
		<?php 
        }
        ?>
	<?php 
    }
    ?>
コード例 #23
0
/**
 * Options page content
 */
function ompf_options_page()
{
    global $ompf_portfolio_options;
    $code = '';
    ?>
	<div class="wrap ompf-options-wrap">
		<div id="icon-options-general" class="icon32"><br></div>
		<h2><?php 
    _e('Portfolio Options', 'om_portfolio');
    ?>
</h2>

		<form method="post" action="options.php" style="max-width:800px">
	    <?php 
    settings_fields('ompf_settings_group');
    ?>
	    <table class="form-table">
	<?php 
    if (isset($ompf_portfolio_options) && is_array($ompf_portfolio_options)) {
        foreach ($ompf_portfolio_options as $option) {
            if (has_filter('ompf_options_page_type_' . $option['type'])) {
                $output .= apply_filters('ompf_options_page_type_' . $option['type'], $option);
                continue;
            }
            switch ($option['type']) {
                case 'text':
                    echo '
							<tr valign="top">
							<th scope="row"><label for="' . $option['id'] . '">' . $option['name'] . '</label></th>
							<td>
								<input type="text" name="' . $option['id'] . '" id="' . $option['id'] . '" value="' . esc_attr(get_option($option['id'])) . '" class="regular-text" />
						';
                    if (isset($option['desc']) && $option['desc']) {
                        echo '<p class="description">' . $option['desc'] . '</p>';
                    }
                    echo '
							</td>
							</tr>
						';
                    break;
                case 'select':
                    echo '
							<tr valign="top">
							<th scope="row"><label for="' . $option['id'] . '">' . $option['name'] . '</label></th>
							<td>
								<select name="' . $option['id'] . '" id="' . $option['id'] . '" >
						';
                    if (isset($option['options']) && is_array($option['options'])) {
                        $std = get_option($option['id']);
                        foreach ($option['options'] as $k => $v) {
                            echo '<option value="' . $k . '"' . ($std == $k ? ' selected="selected"' : '') . '>' . $v . '</option>';
                        }
                    }
                    echo '
								</select>
						';
                    if (isset($option['desc']) && $option['desc']) {
                        echo '<p class="description">' . $option['desc'] . '</p>';
                    }
                    echo '
							</td>
							</tr>
						';
                    break;
                case 'intro':
                    echo '
							</table>
							<div style="margin:10px 0;border:1px solid #ccc;background:#eee;border-radius:3px;padding:13px 10px" id="' . $option['id'] . '">' . $option['message'] . '</div>
							<table class="form-table">
						';
                    break;
                case 'select_page':
                    echo '
							<tr valign="top">
							<th scope="row"><label for="' . $option['id'] . '">' . $option['name'] . '</label></th>
							<td>
								<select name="' . $option['id'] . '" id="' . $option['id'] . '" ><option value="0">' . __('None (default)', 'om_theme') . '</option>
						';
                    $args = array('post_type' => 'page', 'post_status' => 'publish,private,pending,draft');
                    $arr = get_pages($args);
                    $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => get_option($option['id']), 'echo' => 0);
                    $r = wp_parse_args($args, $defaults);
                    echo walk_page_dropdown_tree($arr, 0, $r);
                    echo '
								</select>
						';
                    if (isset($option['desc']) && $option['desc']) {
                        echo '<p class="description">' . $option['desc'] . '</p>';
                    }
                    echo '
							</td>
							</tr>
						';
                    break;
            }
            if (isset($option['code'])) {
                $code .= $option['code'];
            }
        }
    }
    ?>
	    </table>
	    
	    <?php 
    submit_button();
    ?>
		</form>
		<?php 
    echo $code;
    ?>
	</div>
<?php 
}
コード例 #24
0
/**
 * Return a select box allowing to pick which forum/topic a new
 * topic/reply belongs in.
 *
 * @since 2.0.0 bbPress (r2746)
 *
 * @param array $args The function supports these args:
 *  - post_type: Post type, defaults to bbp_get_forum_post_type() (bbp_forum)
 *  - selected: Selected ID, to not have any value as selected, pass
 *               anything smaller than 0 (due to the nature of select
 *               box, the first value would of course be selected -
 *               though you can have that as none (pass 'show_none' arg))
 *  - orderby: Defaults to 'menu_order title'
 *  - post_parent: Post parent. Defaults to 0
 *  - post_status: Which all post_statuses to find in? Can be an array
 *                  or CSV of publish, category, closed, private, spam,
 *                  trash (based on post type) - if not set, these are
 *                  automatically determined based on the post_type
 *  - posts_per_page: Retrieve all forums/topics. Defaults to -1 to get
 *                     all posts
 *  - walker: Which walker to use? Defaults to
 *             {@link BBP_Walker_Dropdown}
 *  - select_id: ID of the select box. Defaults to 'bbp_forum_id'
 *  - tab: Deprecated. Tabindex value. False or integer
 *  - options_only: Show only <options>? No <select>?
 *  - show_none: Boolean or String __( '&mdash; No Forum &mdash;', 'bbpress' )
 *  - disable_categories: Disable forum categories and closed forums?
 *                         Defaults to true. Only for forums and when
 *                         the category option is displayed.
 * @uses BBP_Walker_Dropdown() As the default walker to generate the
 *                              dropdown
 * @uses current_user_can() To check if the current user can read
 *                           private forums
 * @uses bbp_get_forum_post_type() To get the forum post type
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses walk_page_dropdown_tree() To generate the dropdown using the
 *                                  walker
 * @uses apply_filters() Calls 'bbp_get_dropdown' with the dropdown
 *                        and args
 * @return string The dropdown
 */
function bbp_get_dropdown($args = array())
{
    // Setup return value
    $retval = '';
    /** Arguments *********************************************************/
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('post_type' => bbp_get_forum_post_type(), 'post_parent' => null, 'post_status' => null, 'selected' => 0, 'exclude' => array(), 'numberposts' => -1, 'orderby' => 'menu_order title', 'order' => 'ASC', 'posts' => array(), 'walker' => '', 'select_id' => 'bbp_forum_id', 'select_class' => 'bbp_dropdown', 'tab' => false, 'options_only' => false, 'show_none' => false, 'disable_categories' => true, 'disabled' => ''), 'get_dropdown');
    if (empty($r['walker'])) {
        $r['walker'] = new BBP_Walker_Dropdown();
        $r['walker']->tree_type = $r['post_type'];
    }
    // Force 0
    if (is_numeric($r['selected']) && $r['selected'] < 0) {
        $r['selected'] = 0;
    }
    // Force array
    if (!empty($r['exclude']) && !is_array($r['exclude'])) {
        $r['exclude'] = explode(',', $r['exclude']);
    }
    /** Setup Posts *******************************************************/
    /**
     * Allow passing of custom posts data
     *
     * @see bbp_get_reply_to_dropdown() as an example
     */
    if (empty($r['posts'])) {
        $r['posts'] = get_posts(array('post_type' => $r['post_type'], 'post_status' => $r['post_status'], 'post_parent' => $r['post_parent'], 'exclude' => $r['exclude'], 'numberposts' => $r['numberposts'], 'orderby' => $r['orderby'], 'order' => $r['order']));
    }
    /** Drop Down *********************************************************/
    // Build the opening tag for the select element
    if (empty($r['options_only'])) {
        // Should this select appear disabled?
        $disabled = disabled(isset(bbpress()->options[$r['disabled']]), true, false);
        // Setup the tab index attribute
        $tab = !empty($r['tab']) ? ' tabindex="' . intval($r['tab']) . '"' : '';
        // Open the select tag
        $retval .= '<select name="' . esc_attr($r['select_id']) . '" id="' . esc_attr($r['select_id']) . '" class="' . esc_attr($r['select_class']) . '"' . $disabled . $tab . '>' . "\n";
    }
    // Display a leading 'no-value' option, with or without custom text
    if (!empty($r['show_none']) || !empty($r['none_found'])) {
        // Open the 'no-value' option tag
        $retval .= "\t<option value=\"\" class=\"level-0\">";
        // Use deprecated 'none_found' first for backpat
        if (!empty($r['none_found']) && is_string($r['none_found'])) {
            $retval .= esc_html($r['none_found']);
            // Use 'show_none' second
        } elseif (!empty($r['show_none']) && is_string($r['show_none'])) {
            $retval .= esc_html($r['show_none']);
            // Otherwise, make some educated guesses
        } else {
            // Switch the response based on post type
            switch ($r['post_type']) {
                // Topics
                case bbp_get_topic_post_type():
                    $retval .= esc_html__('No topics available', 'bbpress');
                    break;
                    // Forums
                // Forums
                case bbp_get_forum_post_type():
                    $retval .= esc_html__('No forums available', 'bbpress');
                    break;
                    // Any other
                // Any other
                default:
                    $retval .= esc_html__('None available', 'bbpress');
                    break;
            }
        }
        // Close the 'no-value' option tag
        $retval .= '</option>';
    }
    // Items found so walk the tree
    if (!empty($r['posts'])) {
        $retval .= walk_page_dropdown_tree($r['posts'], 0, $r);
    }
    // Close the selecet tag
    if (empty($r['options_only'])) {
        $retval .= '</select>';
    }
    return apply_filters('bbp_get_dropdown', $retval, $r);
}
コード例 #25
0
function wp_dropdown_pages($args = '')
{
    $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'show_option_none' => '');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $pages = get_pages($r);
    $output = '';
    if (!empty($pages)) {
        $output = "<select name='{$name}'>\n";
        if ($show_option_none) {
            $output .= "\t<option value=''>{$show_option_none}</option>\n";
        }
        $output .= walk_page_dropdown_tree($pages, $depth, $r);
        $output .= "</select>\n";
    }
    $output = apply_filters('wp_dropdown_pages', $output);
    if ($echo) {
        echo $output;
    }
    return $output;
}
コード例 #26
0
        /** @see WP_Widget::form */
        function form($instance)
        {
            $widget_options = wp_parse_args($instance, $this->widget_defaults);
            extract($widget_options, EXTR_SKIP);
            $home = (bool) ('on' == $home);
            $autofit = (bool) ('on' == $autofit);
            if ($url != 'http://') {
                ?>
				<p><div class="ibw-thumb">
					<div class="ibw-overlay">
						<span>Preview</span>
					</div>
					
					<img src="<?php 
                echo $url;
                ?>
" />
				</div></p>
				
			<?php 
            }
            ?>
			
			<p><label for="<?php 
            echo $this->get_field_id('title');
            ?>
"><?php 
            _e('Widget Title:');
            ?>
 <?php 
            $this->help_link('title');
            ?>
 <input class="widefat" id="<?php 
            echo $this->get_field_id('title');
            ?>
" name="<?php 
            echo $this->get_field_name('title');
            ?>
" type="text" value="<?php 
            echo $title;
            ?>
" /></label></p>
				
			<p><label for="<?php 
            echo $this->get_field_id('url');
            ?>
"><?php 
            _e('Image URL:', 'image-banner-widget');
            ?>
				<?php 
            $this->help_link('image-url');
            ?>
 
				<input class="widefat" id="<?php 
            echo $this->get_field_id('url');
            ?>
" name="<?php 
            echo $this->get_field_name('url');
            ?>
" type="text" value="<?php 
            echo $url;
            ?>
" /></label></p> 
				<p class="upload-button-wrap"><input id="<?php 
            echo $this->get_field_id('upload_button');
            ?>
" onclick="javascript:formfield = jQuery('#<?php 
            echo $this->get_field_id('url');
            ?>
').attr('name'); tb_show('','media-upload.php?type=image&amp;TB_iframe=true'); return false;" value="Upload/Select from Media" type="button" class="upload-button" /></p>
				
			<p><label for="<?php 
            echo $this->get_field_id('link');
            ?>
"><?php 
            _e('Link:', 'image-banner-widget');
            ?>
 
				<?php 
            $this->help_link('link-url');
            ?>
 
				<input class="widefat" id="<?php 
            echo $this->get_field_id('link');
            ?>
" name="<?php 
            echo $this->get_field_name('link');
            ?>
" type="text" value="<?php 
            echo $link;
            ?>
" /></label></p>
				
			<p><label for="<?php 
            echo $this->get_field_id('target');
            ?>
"><?php 
            _e('Link Target:');
            ?>
 
				<select name="<?php 
            echo $this->get_field_name('target');
            ?>
" id="<?php 
            echo $this->get_field_id('target');
            ?>
" > 	
					<option value="_self" <?php 
            if ('_self' == $target) {
                echo "selected=\"selected\"";
            }
            ?>
 >Current frame</option>		
					<option value="_blank" <?php 
            if ('_blank' == $target) {
                echo "selected=\"selected\"";
            }
            ?>
 >New page/tab</option>
					<option value="_top" <?php 
            if ('_top' == $target) {
                echo "selected=\"selected\"";
            }
            ?>
 >Top frame</option>
				</select></label> <?php 
            $this->help_link('target');
            ?>
 </p>
				
			<p><label for="<?php 
            echo $this->get_field_id('category');
            ?>
"><?php 
            _e('Display for:');
            ?>
				<select name="<?php 
            echo $this->get_field_name('category');
            ?>
" id="<?php 
            echo $this->get_field_id('category');
            ?>
" > 	
					<option value="shailan-show-all-categories" <?php 
            if ('shailan-show-all-categories' == $category) {
                echo "selected=\"selected\"";
            }
            ?>
 >All categories</option>		
					<option value="shailan-home-only" <?php 
            if ('shailan-home-only' == $category) {
                echo "selected=\"selected\"";
            }
            ?>
 >Homepage only</option>		
					 <?php 
            $options = "";
            $categories = get_categories('');
            foreach ($categories as $cat) {
                $options .= "\n" . '<option value="' . $cat->category_nicename . '" ' . ($cat->category_nicename == $category ? ' selected="selected"' : '') . '>';
                $options .= $cat->cat_name;
                $options .= '</option>\\n';
                //echo $option;
            }
            $r = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
            $pages = get_pages($r);
            $options .= walk_page_dropdown_tree($pages, 0, $r);
            echo $options;
            ?>
					
					</select></label> <?php 
            $this->help_link('display-for');
            ?>
 </p>

			<p><input type="checkbox" class="checkbox" id="<?php 
            echo $this->get_field_id('home');
            ?>
" name="<?php 
            echo $this->get_field_name('home');
            ?>
"<?php 
            checked($home);
            ?>
 />
			<label for="<?php 
            echo $this->get_field_id('home');
            ?>
"><?php 
            _e('Display on homepage');
            ?>
 <?php 
            $this->help_link('display');
            ?>
</label></p>

			<p><input type="checkbox" class="checkbox" id="<?php 
            echo $this->get_field_id('autofit');
            ?>
" name="<?php 
            echo $this->get_field_name('autofit');
            ?>
"<?php 
            checked($autofit);
            ?>
 />
			<label for="<?php 
            echo $this->get_field_id('autofit');
            ?>
"><?php 
            _e('Auto-fit to container width', 'image-banner-widget');
            ?>
 <?php 
            $this->help_link('autofit');
            ?>
</label></p>
			
			<div class="ibw-advanced-toggle"><span onclick="jQuery(this).next('div').slideToggle();" class="expander" ><?php 
            _e('Advanced Settings..', 'image-banner-widget');
            ?>
</span>
			<div class="ibw-advanced-options" style="display:none;">
			
			<p><label for="<?php 
            echo $this->get_field_id('alt');
            ?>
"><?php 
            _e('Alternative Text:', 'image-banner-widget');
            ?>
 
				<?php 
            $this->help_link('alternate-text');
            ?>
 
				<input class="widefat" id="<?php 
            echo $this->get_field_id('alt');
            ?>
" name="<?php 
            echo $this->get_field_name('alt');
            ?>
" type="text" value="<?php 
            echo $alt;
            ?>
" /></label></p>
				
			<p><label for="<?php 
            echo $this->get_field_id('image_title');
            ?>
"><?php 
            _e('Image Title:', 'image-banner-widget');
            ?>
				<?php 
            $this->help_link('image_title');
            ?>
 
				<input class="widefat" id="<?php 
            echo $this->get_field_id('image_title');
            ?>
" name="<?php 
            echo $this->get_field_name('image_title');
            ?>
" type="text" value="<?php 
            echo $image_title;
            ?>
" /></label></p>
			
			

			</div>
			</div>
			
		<div class="widget-control-actions">
			<p><small>Powered by <a href="http://shailan.com/wordpress/plugins/image-banner-widget" title="Wordpress Tips and tricks, Freelancing, Web Design">Shailan.com</a></small></p>
		</div>
		
		<script>
jQuery(document).ready(function()
{

	jQuery('#<?php 
            echo $this->get_field_id('upload_button');
            ?>
').click(function() {
	 formfield = jQuery('#upload_image').attr('name');
	 tb_show('','media-upload.php?type=image&amp;TB_iframe=true');
	 return false;
	});
	// send url back to plugin editor

	window.send_to_editor = function(html) {
		 imgurl = jQuery('img',html).attr('src');
		 jQuery('#<?php 
            echo $this->get_field_id('url');
            ?>
').val(imgurl);
		 tb_remove();
	}
  
});
		</script>
		
				<div class="clear"></div>
				
			<?php 
        }
コード例 #27
0
/**
 * Retrieve or display list of pages as a dropdown (select list).
 *
 * @since 2.1.0
 * @since 4.2.0 The `$value_field` argument was added.
 * @since 4.3.0 The `$class` argument was added.
 *
 * @param array|string $args {
 *     Optional. Array or string of arguments to generate a pages drop-down element.
 *
 *     @type int          $depth                 Maximum depth. Default 0.
 *     @type int          $child_of              Page ID to retrieve child pages of. Default 0.
 *     @type int|string   $selected              Value of the option that should be selected. Default 0.
 *     @type bool|int     $echo                  Whether to echo or return the generated markup. Accepts 0, 1,
 *                                               or their bool equivalents. Default 1.
 *     @type string       $name                  Value for the 'name' attribute of the select element.
 *                                               Default 'page_id'.
 *     @type string       $id                    Value for the 'id' attribute of the select element.
 *     @type string       $class                 Value for the 'class' attribute of the select element. Default: none.
 *                                               Defaults to the value of `$name`.
 *     @type string       $show_option_none      Text to display for showing no pages. Default empty (does not display).
 *     @type string       $show_option_no_change Text to display for "no change" option. Default empty (does not display).
 *     @type string       $option_none_value     Value to use when no page is selected. Default empty.
 *     @type string       $value_field           Post field used to populate the 'value' attribute of the option
 *                                               elements. Accepts any valid post field. Default 'ID'.
 * }
 * @return string HTML content, if not displaying.
 */
function wp_dropdown_pages($args = '')
{
    $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'class' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '', 'value_field' => 'ID');
    $r = wp_parse_args($args, $defaults);
    $pages = get_pages($r);
    $output = '';
    // Back-compat with old system where both id and name were based on $name argument
    if (empty($r['id'])) {
        $r['id'] = $r['name'];
    }
    if (!empty($pages)) {
        $class = '';
        if (!empty($r['class'])) {
            $class = " class='" . esc_attr($r['class']) . "'";
        }
        $output = "<select name='" . esc_attr($r['name']) . "'" . $class . " id='" . esc_attr($r['id']) . "'>\n";
        if ($r['show_option_no_change']) {
            $output .= "\t<option value=\"-1\">" . $r['show_option_no_change'] . "</option>\n";
        }
        if ($r['show_option_none']) {
            $output .= "\t<option value=\"" . esc_attr($r['option_none_value']) . '">' . $r['show_option_none'] . "</option>\n";
        }
        $output .= walk_page_dropdown_tree($pages, $r['depth'], $r);
        $output .= "</select>\n";
    }
    /**
     * Filters the HTML output of a list of pages as a drop down.
     *
     * @since 2.1.0
     * @since 4.4.0 `$r` and `$pages` added as arguments.
     *
     * @param string $output HTML output for drop down list of pages.
     * @param array  $r      The parsed arguments array.
     * @param array  $pages  List of WP_Post objects returned by `get_pages()`
     */
    $html = apply_filters('wp_dropdown_pages', $output, $r, $pages);
    if ($r['echo']) {
        echo $html;
    }
    return $html;
}
コード例 #28
0
/**
* Renders a select with the given $post_type posts as options, $name as name and $selected as selected option
*
* Move this to a more general file, for god's sake
*
* Used also in the post relationship filter
*
* @todo move this to the post relationship filter, it is not used here anymore
*/

function wpv_show_posts_dropdown( $post_type, $name = '_wpv_settings[parent_id]', $selected = 0 ) {
	$hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );	
	$attr = array(
		'name'=> $name,
		'post_type' => $post_type,
		'show_option_none' => __('None', 'wpv-views'),
		'selected' => $selected
	);
	if ( in_array( $post_type, $hierarchical_post_types ) ) {
		wp_dropdown_pages( $attr );
	} else {
		$defaults = array(
			'depth' => 0, 
			'child_of' => 0,
			'selected' => $selected,
			'echo' => 1,
			'name' => 'page_id',
			'id' => '',
			'show_option_none' => '',
			'show_option_no_change' => '',
			'option_none_value' => ''
		);
		$r = wp_parse_args( $attr, $defaults );
		extract( $r, EXTR_SKIP );		
		$pages = get_posts( array( 'numberposts' => -1, 'post_type' => $post_type, 'suppress_filters' => false ) );
		$output = '';
		// 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='" . esc_attr( $name ) . "' id='" . esc_attr( $id ) . "'>\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";
		}
		echo $output;	
	}
}
コード例 #29
0
        ?>
" <?php 
        selected($selected, $key);
        ?>
><?php 
        echo $option;
        ?>
</option>
					<?php 
    }
    ?>
				
					<?php 
    if (isset($s['page'])) {
        ?>
						<?php 
        $args = array('depth' => $s['page'], 'child_of' => 0, 'selected' => $selected, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
        $pages = get_pages($args);
        echo walk_page_dropdown_tree($pages, $depth, $args);
        ?>
					<?php 
    }
    ?>
				</select>
			</div>
		<?php 
}
?>
	</div>
</div>
 private function show_posts_options($post_type, $name, $selected = 0, $page = 1, $paged = 1)
 {
     if ($post_type == 'ddl-all-post-types') {
         $post_type = 'any';
     }
     $attr = array('name' => $name, 'post_type' => $post_type, 'show_option_none' => __('None', 'ddl-layouts'), 'selected' => $selected);
     add_filter('posts_clauses_request', array($this, 'posts_clauses_request_filter'), 10, 2);
     $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => $selected, 'echo' => 1, 'name' => 'page_id', 'id' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
     $r = wp_parse_args($attr, $defaults);
     extract($r, EXTR_SKIP);
     $pages = get_posts(array('posts_per_page' => self::POSTS_PER_PAGE, 'post_type' => $post_type, 'suppress_filters' => false, 'paged' => $page, 'page' => $paged));
     $count = count($pages);
     $total = $this->count_type($post_type);
     $output = '';
     // Back-compat with old system where both id and name were based on $name argument
     if (empty($id)) {
         $id = $name;
     }
     if (!empty($pages)) {
         $output = walk_page_dropdown_tree($pages, $depth, $r);
     }
     remove_filter('posts_clauses_request', array($this, 'posts_clauses_request_filter'), 10, 2);
     return array('html' => $output, 'total' => $total, 'count' => $count);
 }