本文整理汇总了PHP中walk_page_dropdown_tree函数的典型用法代码示例。如果您正苦于以下问题:PHP walk_page_dropdown_tree函数的具体用法?PHP walk_page_dropdown_tree怎么用?PHP walk_page_dropdown_tree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了walk_page_dropdown_tree函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: simple_sidenav_pages
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;
}
开发者ID:raheenbabul,项目名称:flaming-lana,代码行数:26,代码来源:simple-sidenav.php
示例2: msc_alwaysloaddropdown_pages
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;
}
开发者ID:WildGenie,项目名称:My-Shortcodes,代码行数:27,代码来源:alwaysload.php
示例3: parentfilter_add_dropdown
/**
* 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"' : '') . '>' . __('— None/Root —', 'parent-filter') . '</option>';
// Print the queried items
echo walk_page_dropdown_tree($query->posts, 0, $request);
echo '</select>';
}
}
开发者ID:dougwollison,项目名称:parent-filter,代码行数:31,代码来源:parent-filter.php
示例4: pageForPostsDropdown
/**
* 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;
}
开发者ID:helsingborg-stad,项目名称:Municipio,代码行数:31,代码来源:General.php
示例5: om_options_generator
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"';
//.........这里部分代码省略.........
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:101,代码来源:theme-options.php
示例6: show_posts_dropdown
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);
}
开发者ID:javierdlahoz,项目名称:paella-development,代码行数:30,代码来源:post-content-cell.php
示例7: admin_private_parent_metabox
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;
}
开发者ID:TheRandumbGuy1,项目名称:Website,代码行数:26,代码来源:functions.php
示例8: stachestack_bbp_get_dropdown
/**
* 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');
//.........这里部分代码省略.........
开发者ID:BeardandFedora,项目名称:StacheStack,代码行数:101,代码来源:bbpress.php
示例9: bbp_get_dropdown
/**
* 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
//.........这里部分代码省略.........
开发者ID:rmccue,项目名称:bbPress,代码行数:101,代码来源:bbp-common-template.php
示例10: _e
_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;
?>
" />
开发者ID:adisonc,项目名称:MaineLearning,代码行数:31,代码来源:edit_schedule.php
示例11: wp_dropdown_posts
/**
* 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;
}
开发者ID:sbhambad,项目名称:TimousDemo,代码行数:44,代码来源:generic.php
示例12: foreach
// 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>
开发者ID:kivivuori,项目名称:jotain,代码行数:30,代码来源:view-translations-post.php
示例13: k_blox_to_dropdown
/**
* 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);
}
开发者ID:CUPolishSociety,项目名称:campolsoc,代码行数:17,代码来源:custom_functions.php
示例14: wt_multidropdown
/**
* 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>';
}
开发者ID:panchortuzar,项目名称:revistaemprendedores-shop,代码行数:71,代码来源:options.php
示例15: _e
?>
</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('— Select —');
?>
</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.
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:31,代码来源:settings.php
示例16: wp_dropdown_pages
/**
* 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;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:50,代码来源:post-template.php
示例17: wp_dropdown_pages
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;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:29,代码来源:post-template.php
示例18: wp_dropdown_pages
/**
* 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<opti
|
请发表评论