本文整理汇总了PHP中wp_dropdown_pages函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_dropdown_pages函数的具体用法?PHP wp_dropdown_pages怎么用?PHP wp_dropdown_pages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_dropdown_pages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view_options
private function view_options()
{
require_once ABSPATH . '/wp-admin/options-head.php';
wp_enqueue_style('yop-poll-wizard-css', YOP_POLL_URL . 'css/yop-poll-wizard.css', array(), YOP_POLL_VERSION);
wp_enqueue_script('yop-poll-wizard-js', YOP_POLL_URL . 'js/polls/wizard-options.js', array('jquery'), YOP_POLL_VERSION, true);
$translation_array = array('next_next' => __("Next"), 'prev_prev' => __yop_poll("Previous"), 'savee' => __('Save'), 'empty_answer' => __yop_poll("Please fill in empty answers from Question"));
wp_localize_script('yop-poll-wizard-js', 'button_yop', $translation_array);
wp_enqueue_script('jquery-ui-dialog');
$isdone = array(1);
wp_localize_script('yop-poll-wizard-js', 'isdone', $isdone);
wp_enqueue_style('yop-poll-slider-css', YOP_POLL_URL . 'css/yop-poll-slider.css', array(), YOP_POLL_VERSION);
wp_enqueue_script('yop-poll-add-edit-js', YOP_POLL_URL . 'js/polls/yop-poll-add-edit.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-dialog'), YOP_POLL_VERSION, true);
wp_enqueue_script('yop-poll-slider-js', YOP_POLL_URL . 'js/yop-poll-slider.js', array('jquery', 'jquery-ui-dialog'), YOP_POLL_VERSION, true);
$data['poll_url'] = YOP_POLL_URL;
wp_enqueue_style('yop-poll-add-edit-css', YOP_POLL_URL . 'css/polls/add-edit.css', array(), YOP_POLL_VERSION);
global $page;
//load all options and display them
$time_format = "H:i:s";
$options = get_option('yop_poll_options');
if ($options['date_format'] == "UE") {
$date_format = "d-m-Y";
} else {
$date_format = "m-d-Y";
}
$data['date_format'] = $date_format . ' ' . $time_format;
$data['yop_poll_options'] = get_option('yop_poll_options', array());
$data['title'] = __yop_poll("General Options");
$options = $data['yop_poll_options'];
$args = array('name' => 'yop_poll_options[yop_poll_archive_page_id]', 'selected' => $options['yop_poll_archive_page_id'], 'echo' => false);
$data['poll_archive'] = wp_dropdown_pages($args);
$this->display('general.html', $data);
}
示例2: create_edc_page_options
public function create_edc_page_options($post)
{
// Page type dropdown
$edc_page_type = get_post_meta($post->ID, 'edc_page_type', true) or '';
$edc_page_type_options = array('' => 'Default', 'mirror' => 'Mirror', 'redirect' => 'Redirect');
echo '<p><strong>Page Type</strong></p>';
echo '<label class="screen-reader-text" for="edc_page_type">Page Type</label>';
echo '<select id="edc_page_type" name="edc_page_type">';
foreach ($edc_page_type_options as $val => $text) {
$selected = $val == $edc_page_type ? 'selected="selected"' : '';
echo "<option value='{$val}' {$selected}>{$text}</option>";
}
echo '</select>';
// Dropdown for page to mirror
$edc_mirror_id = get_post_meta($post->ID, 'edc_mirror_id', true);
$pages = wp_dropdown_pages(array('post_type' => 'page', 'exclude_tree' => $post->ID, 'selected' => $edc_mirror_id, 'name' => 'edc_mirror_id', 'show_option_none' => '-- Select One --', 'sort_column' => 'menu_order, post_title', 'echo' => 0));
echo '<div id="edc_mirror_page_options"' . ($edc_page_type == 'mirror' ? '' : ' style="display: none;"') . '">';
echo '<p><strong>Page to Mirror</strong></p>';
echo '<label class="screen-reader-text" for="edc_mirror_id">Page to Mirror</label>';
echo $pages;
echo '</div>';
// Hide from menu checkbox
$edc_hide_from_menu = get_post_meta($post->ID, 'edc_hide_from_menu', true);
$checked = $edc_hide_from_menu ? 'checked="checked"' : '';
echo '<p><strong>Menu Options</strong></p>';
echo '<p><label class="selectit" for="edc_hide_from_menu">';
echo " <input name='edc_hide_from_menu' type='hidden' value='0' />";
echo " <input id='edc_hide_from_menu' name='edc_hide_from_menu' type='checkbox' {$checked} value='1' />";
echo ' Hide from menu.';
echo '</label></p>';
}
示例3: form
public function form($instance)
{
$instance = wp_parse_args((array) $instance, array('title' => '', 'project' => 0));
$title = strip_tags($instance['title']);
$project = (int) $instance['project'];
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title:', 'buggypress');
?>
</label>
<input class="widefat" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" type="text" value="<?php
echo esc_attr($title);
?>
" /></p>
<p>
<?php
wp_dropdown_pages(array('post_type' => BuggyPress_Project::POST_TYPE, 'post_status' => 'publish', 'show_option_none' => __('Current Context', 'buggypress'), 'option_none_value' => 0, 'selected' => $project, 'name' => $this->get_field_name('project'), 'id' => $this->get_field_id('project')));
?>
</p>
<?php
}
示例4: render_content
/**
* Render the control's content.
*
* @since 3.4.0
*/
public function render_content()
{
$dropdown = wp_dropdown_pages(array('name' => '_customize-dropdown-pages-' . $this->id, 'echo' => 0, 'show_option_none' => __('— Select Pages —', 'the-monday'), 'option_none_value' => '', 'selected' => $this->value()));
// Hackily add in the data link parameter.
$dropdown = str_replace('<select', '<select ' . $this->get_link(), $dropdown);
printf('<label class="customize-control-select"><span class="customize-control-title">%s</span><span class="description customize-control-description">%s</span> %s </label>', $this->label, $this->description, $dropdown);
}
示例5: pasw_meta_box
function pasw_meta_box($page) {
$children = get_pages('child_of='.$page->ID); //load all the kids
if ( count($children) != 0 ) { //display the select box only if we have child pages
print '<p>';
print '<strong>'.__("Page").': </strong>';
print '<label for="pasw_select" class="screen-reader-text">'.__("Page to display as Widget").'</label>';
$default = (get_post_meta($page->ID, 'pasw_widget_page_id', true));
wp_dropdown_pages('child_of='.$page->ID.'&name=pasw_select&show_option_none=None&selected='.$default);
print '</p>';
print '<input type="hidden" id="pasw_last_subpage" name="pasw_last_subpage" value="'.$default.'" />';
if ($default) {
$dtitle = get_the_title($default);
edit_post_link('edit '. $dtitle, '<p>', '</p>', $default);
}
} else {
$parentid = get_post_meta($page->ID, 'pasw_is_subpage');
if (is_numeric($parentid[0])) {
$title = get_the_title($parentid[0]);
$link = get_page_link($parentid[0]);
$editlink = get_edit_post_link($parentid[0]);
print __("This page is a sidebar of '<a href=\"".$link."\">".$title."</a>', you can edit '".$title."' <a href=\"".$editlink."\">here</a>.");
} else {
print __("No sub pages found, add a subpage to use it as a widget");
}
}
}
示例6: form
/**
** Back-end widget form.
**
** @see WP_Widget::form()
**
** @param array $instance Previously saved values from database.
**/
function form($instance)
{
$thisTitle = isset($instance['title']) ? esc_attr($instance['title']) : 'NL - Link to Page';
$thisPage = isset($instance['page']) ? $instance['page'] : 0;
$argsPage = array('authors' => '', 'child_of' => 0, 'depth' => 0, 'echo' => 1, 'exclude' => '', 'exclude_tree' => '', 'hierarchical' => 1, 'include' => '', 'meta_key' => '', 'meta_value' => '', 'name' => $this->get_field_name('page'), 'post_type' => 'page', 'selected' => $thisPage, 'sort_column' => 'post_title', 'sort_order' => 'ASC');
ob_start();
?>
<div style="padding: 5px 0px">
Display Title:
<input type="text" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" size="20" value="<?php
echo $thisTitle;
?>
"/>
</div>
<div style="padding: 5px 0px">
Page:
<?php
wp_dropdown_pages($argsPage);
?>
</div>
<?php
echo ob_get_clean();
}
示例7: render_content
public function render_content()
{
switch ($this->type) {
case 'textarea':
?>
<label>
<span class="customize-control-title"><?php
echo esc_html($this->label);
?>
</span>
<textarea rows="5" style="width:100%;" <?php
$this->link();
?>
><?php
echo esc_textarea($this->value());
?>
</textarea>
</label>
<?php
break;
case 'dropdown-pages':
$dropdown = wp_dropdown_pages(array('name' => '_customize-dropdown-pages-' . $this->id, 'echo' => 0, 'show_option_none' => __('— Select —', 'wp-profile'), 'option_none_value' => '0', 'selected' => $this->value()));
$dropdown = str_replace('<select', '<select ' . $this->get_link(), $dropdown);
printf('<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>', $this->label, $dropdown);
break;
}
}
示例8: render_content
public function render_content()
{
$dropdown = wp_dropdown_pages(array('name' => '_customize-dropdown-blocks-content-' . $this->id, 'echo' => 0, 'show_option_none' => __('— Select —'), 'option_none_value' => '0', 'selected' => $this->value(), 'post_type' => 'blocks_content'));
// Hackily add in the data link parameter.
$dropdown = str_replace('<select', '<select ' . $this->get_link(), $dropdown);
printf('<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>', $this->label, $dropdown);
}
示例9: admin_metabox
/**
* Render Metabox
*
* @param type $item
*/
public function admin_metabox($item)
{
$group_id = $item->id;
$page_id = groups_get_groupmeta($group_id, '_group_linked_page', true);
wp_nonce_field('_bp_linked_group_page', '_bp_linked_group_page_nonce');
wp_dropdown_pages(array('name' => '_group_linked_page', 'selected' => $page_id, 'show_option_none' => __('Please select a page')));
}
示例10: render_content
public function render_content()
{
?>
<label class="customize-control-select">
<?php
if (!empty($this->label)) {
?>
<span class="customize-control-title"><?php
echo esc_html($this->label);
?>
</span>
<?php
}
// Description
if (!empty($this->description)) {
?>
<span class="description customize-control-description"><?php
echo $this->description;
?>
</span>
<?php
}
$dropdown = wp_dropdown_pages(array('name' => '_customize-dropdown-pages-' . $this->id, 'echo' => 0, 'show_option_none' => __('— Select —', 'wpex'), 'option_none_value' => '0', 'selected' => $this->value()));
// Hackily add in the data link parameter.
echo str_replace('<select', '<select ' . $this->get_link(), $dropdown);
}
示例11: kt_cmb2_render_page_field_callback
/**
* Render 'Page' custom field type
*
* @since 0.1.0
*
* @param array $field The passed in `CMB2_Field` object
* @param mixed $value The value of this field escaped.
* It defaults to `sanitize_text_field`.
* If you need the unescaped value, you can access it
* via `$field->value()`
* @param int $object_id The ID of the current object
* @param string $object_type The type of object you are working with.
* Most commonly, `post` (this applies to all post-types),
* but could also be `comment`, `user` or `options-page`.
* @param object $field_type_object The `CMB2_Types` object
*/
function kt_cmb2_render_page_field_callback($field, $value, $object_id, $object_type, $field_type_object)
{
$args = array('name' => $field->args['id'], 'id' => $field->args['id']);
if ($field->value) {
$args['selected'] = $field->value;
}
wp_dropdown_pages($args);
}
示例12: to_json
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
* @access public
*/
public function to_json()
{
parent::to_json();
$l10n = Kirki_l10n::get_strings($this->kirki_config);
$dropdown = wp_dropdown_pages(array('name' => '_customize-dropdown-pages-' . esc_attr($this->id), 'echo' => 0, 'show_option_none' => esc_attr($l10n['select-page']), 'option_none_value' => '0', 'selected' => esc_attr($this->value())));
// Hackily add in the data link parameter.
$dropdown = str_replace('<select', '<select ' . $this->get_link(), $dropdown);
$this->json['dropdown'] = $dropdown;
}
示例13: form
public function form($instance)
{
if ($instance) {
$title = esc_attr($instance['title']);
} else {
$title = __('', 'charity-life-wpl');
}
if (isset($instance['page_id'])) {
$page_id = (int) $instance['page_id'];
} else {
$page_id = 0;
}
?>
<p>
<label for="<?php
echo esc_attr($this->get_field_id('title'));
?>
"> <?php
_e('Title:', 'charity-life-wpl');
?>
</label>
<input class="widefat" id="<?php
echo esc_attr($this->get_field_id('title'));
?>
" name="<?php
echo esc_attr($this->get_field_name('title'));
?>
" type="text" value="<?php
echo esc_html($title);
?>
" />
</p>
<p>
<label for="<?php
echo esc_attr($this->get_field_id('pages'));
?>
"> <?php
_e('Page:', 'charity-life-wpl');
?>
</label>
<?php
$args = array('id' => $this->get_field_id('page_id'), 'name' => $this->get_field_name('page_id'), 'selected' => $page_id);
wp_dropdown_pages($args);
?>
</p>
<br />
<p style="font-size: 10px; color: #999; margin: -10px 0 0 0px; padding: 0px;">
<?php
printf(__('The ID of this widget is: %1$s %3$s %2$s', 'charity-life-wpl'), '<strong>', '</strong>', '#' . esc_attr($this->id));
?>
</p>
<br />
<?php
}
示例14: rmag_primary_options
function rmag_primary_options($content)
{
global $rcl_options;
$rcl_options = get_option('primary-rmag-options');
include_once RCL_PATH . 'functions/rcl_options.php';
$opt = new Rcl_Options(rcl_key_addon(pathinfo(__FILE__)));
$args = array('selected' => $rcl_options['basket_page_rmag'], 'name' => 'basket_page_rmag', 'show_option_none' => '<span style="color:red">Не выбрано</span>', 'echo' => 0);
$content .= $opt->options('Настройки WP-RECALL-MAGAZIN', array($opt->option_block(array($opt->title('Общие настройки'), $opt->label('Email для уведомлений'), $opt->option('email', array('name' => 'admin_email_magazin_recall')), $opt->notice('Если email не указан, то уведомления будут рассылаться всем пользователям сайта с правами "Администратор"'), $opt->label('Наценка на товары (%)'), $opt->option('number', array('name' => 'margin_product')), $opt->notice('Если ноль или ничего нет, то наценка на товары не используется'))), $opt->option_block(array($opt->title('Оформление заказа'), $opt->label('Регистрация при оформлении'), $opt->option('select', array('name' => 'noreg_order', 'options' => array('Включено', 'Отключено'))), $opt->notice('Если включено, то пользователь автоматически регистрируется на сайте при успешном оформлении заказа'))), $opt->option_block(array($opt->title('Учет товара'), $opt->label('Учет товара на складе'), $opt->option('select', array('name' => 'products_warehouse_recall', 'options' => array('Отключено', 'Включено'))), $opt->notice('Если учет ведется, то у товаров можно будет отмечать наличие на складе. Если товар не в наличии, то кнопка на добавление товара в корзину отсутствует'))), $opt->option_block(array($opt->title('Корзина'), $opt->label('Порядок вывода кнопки "В корзину"'), $opt->option('select', array('name' => 'add_basket_button_recall', 'options' => array('Автоматически', 'Через шорткод'))), $opt->notice('На странице товара. Если шорткод, то используем [add-basket]'), $opt->label('Страница оформления заказа'), wp_dropdown_pages($args), $opt->notice('Укажите страницу, где размещен шорткод [basket]'))), $opt->option_block(array($opt->title('Система похожих или рекомендуемых товаров'), $opt->label('Порядок вывода'), $opt->option('select', array('name' => 'sistem_related_products', 'options' => array('Отключено', 'Включено'))), $opt->notice('Если учет ведется, то у товаров можно будет отмечать наличие на складе. Если товар не в наличии, то кнопка на добавление товара в корзину отсутствует'), $opt->label('Заголовок блока рекомендуемых товаров'), $opt->option('text', array('name' => 'title_related_products_recall')), $opt->label('Количество рекомендуемых товаров'), $opt->option('number', array('name' => 'size_related_products')))), $opt->option_block(array($opt->title('Валюта и курсы'), $opt->label('Основная валюта'), $opt->option('select', array('name' => 'primary_cur', 'options' => rcl_get_currency())), $opt->label('Второстепенная валюта'), $opt->option('select', array('name' => 'multi_cur', 'parent' => true, 'options' => array('Отключено', 'Включено'))), $opt->child(array('name' => 'multi_cur', 'value' => 1), array($opt->label('Выберите валюту'), $opt->option('select', array('name' => 'secondary_cur', 'options' => rcl_get_currency())), $opt->label('Курс'), $opt->option('text', array('name' => 'curse_currency')), $opt->notice('Укажите курс второстепенной валюты по отношению к основной. Например: 1.3')))))));
return $content;
}
示例15: cf7_success_page_panel_meta
function cf7_success_page_panel_meta($post)
{
wp_nonce_field('cf7_success_page_metaboxes', 'cf7_success_page_metaboxes_nonce');
$cf7_success_page = get_post_meta($post->id(), '_cf7_success_page_key', true);
// The meta box content
$dropdown_options = array('echo' => 0, 'name' => 'cf7-redirect-page-id', 'show_option_none' => '--', 'option_none_value' => '0', 'selected' => $cf7_success_page);
echo '<h3>Redirect Settings</h3>
<fieldset>
<legend>Select a page to redirect to on successful form submission.</legend>' . wp_dropdown_pages($dropdown_options) . '</fieldset>';
}