WordPress:Template Tags/wp dropdown pages
This article is [[WordPress::Category:Copyedits|marked]] as in need of editing. You can help Codex by editing it.
Description
This article is [[WordPress::Category:Copyedits|marked]] as in need of editing. You can help Codex by editing it.
描述
Displays a list of pages in a select (i.e dropdown) box with no submit button.
在一个拥有递交按钮的挑选框(如 下拉列表)中显示一列网页。
Usage
%%% <?php wp_dropdown_pages('arguments'); ?> %%%
用法
%%% <?php wp_下拉列表_网页('参数'); ?> %%%
Examples
Default Usage
例子
默认用法
$defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1,'name' => 'page_id', 'show_option_none' => '');
$默认 = array('depth' => 0, 'child_of' => 0, '挑选的' => 0, 'echo' => 1,'名称' => '网页_id', '显示_选项_none' => '');
By default, the usage shows:
默认情况下,用法显示:
- Pages and sub-pages displayed in hierarchical (indented) form
- 以层级方式(嵌入式)显示的网页和子网页。
- Displays all pages (not restricted to child pages)
- 显示所有的网页(不局限于子网页)
- No page is be 'selected' or presented in the display box
- 没有网页会被'选到'或者呈现在显示框中
- The name assigned to the dropdown form is 'page_id'
- 指派到下拉列表形式的名称是'网页_id'
- Allows you to select NONE of the pages (show_option_none)
- 允许你不选择任何网页(不显示_任何_选项)
<?php wp_dropdown_pages(); ?>
<?php wp_下拉列表_网页(); ?>
Dropdown with Submit Button
拥有递交按钮的下拉列表
Displays a hierarchical page dropdown list in HTML form with a submit button.
将一个层级网页的下拉列表以HTML形式显示,拥有一个递交按钮。
<li id="pages"> <h2><?php _e('pages:'); ?></h2> <form action="<?php bloginfo('url'); ?>" method="get"> <?php wp_dropdown_pages(); ?> <input type="submit" name="submit" value="view" /> </form> </li>
<li id="pages">
<h2><?php _e('pages:'); ?></h2> <form action="<?php bloginfo('url'); ?>" method="get"> <?php wp_dropdown_pages(); ?> <input type="submit" name="submit" value="view" /> </form> </li>
Parameters
参数
- depth (integer)
- This parameter controls how many levels in the hierarchy of pages are to be included in the list generated by wp_list_pages. The default value is 0 (display all pages, including all sub-pages).
- 深度(整数)
- 这个参数控制了wp_列表_网页产生的列表中包含有多少个层级的网页。默认值为0 (显示所有的网页,包括子网页)。
- 0 - Pages and sub-pages displayed in hierarchical (indented) form (Default).
- 0 -网页和子网页以层级(嵌入式)方式显示(默认)。
- -1 - Pages in sub-pages displayed in flat (no indent) form.
- -1 -子网页中的网页安装flat(非嵌入)的方式显示。
- 1 - Show only top level Pages
- 1 -只显示最高级别的网页
- 2 - Value of 2 (or greater) specifies the depth (or level) to descend in displaying Pages.
- 2 -2(或者更高的数字)的参数规定了显示网页时的可以下降的深度(层级)。
- child_of (integer)
- Displays the sub-pages of a single Page only; uses the ID for a Page as the value. Defaults to 0 (displays all Pages).
- 子_of (整数)
- 只显示一个单独网页的子网页;为网页使用ID作为参数值。默认为0(显示所有的网页)。
- selected
- (integer) Page ID of the page to be 'selected' or presented in the display box. Defaults to no page selected.
- 挑选的
- (整数)在显示框中被'选上'或者显示的网页ID。默认为没有选择网页。
- echo (boolean)
- Toggles the display of the generated list of links or return the list as an HTML text string to be used in PHP. The default value is 1 (display the generated list items). Valid values:
- echo (boolean)
- Toggles链接的总列表的显示或者返回列表作为HTML文本字符串,用于PHP。默认值是1 (显示总列表内容)。有效的参数值:
- 1 (true) - default
- 0 (false)
- 1 (正确的) - 默认的
- 0 (错误的)
- name
- (string) Name assigned to the dropdown form. Defaults to 'page_id'.
- 名称
- (string)指派给下拉列表形式的名称。默认为'网页_id'。
- show_option_none
- (string) Causes the HTML for the dropdown to allow you to select NONE of the pages.
- 不显示_任何_选项
- (string)致使下拉列表的HTML,允许你不选择任何网页。
- exclude
- (string) Comma separated list of category IDs to exclude. For example, 'exclude=4,12' means category IDs 4 and 12 will NOT be displayed/echoed or returned. Defaults to exclude nothing.
- 删除
- (string)逗号将需要删除的类别IDs列表分开。例如,'删除=4,12'指的是删除类别ID为4和12的类别不会显示/echoed或者返回。默认为不删除任何内容。
Other Parameters
其它的参数
It is possible, but not confirmed, some of the paramters for the function get_pages could be used for wp_dropdown_pages. Here's the default settings for the get_pages parameters 函数得到_网页的一些参数有可能被用来wp_下拉列表_网页,但这并不是一定的。下面是得到_网页参数的默认设置
$defaults = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '');
$默认 = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', '作者' => '');