WordPress: Template Tags/wp dropdown pages:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: {{Copyedit}} == Description == Displays a list of pages in a select (i.e dropdown) box with no submit button. == Usage == %%% <?php wp_dropdown_pages('arguments'); ?> %%% == Examples ==...)
 
 
(未显示2个用户的2个中间版本)
第1行: 第1行:
{{Copyedit}}
{{Copyedit}}
== Description ==
==描述==
Displays a list of pages in a select (i.e dropdown) box with no submit button.


== Usage ==
在一个拥有递交按钮的挑选框(如 下拉列表)中显示一列网页。
 
== 用法 ==
%%% <?php wp_dropdown_pages('arguments'); ?> %%%
%%% <?php wp_dropdown_pages('arguments'); ?> %%%


== Examples ==
== 例子 ==
===Default Usage===
===默认用法===
<pre>
<pre>
$defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0,  
$defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0,  
'echo' => 1,'name' => 'page_id', 'show_option_none' => '');</pre>
'echo' => 1,'name' => 'page_id', 'show_option_none' => '');</pre>
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'
 
* Allows you to select NONE of the pages (show_option_none)
*显示所有的网页(不局限于子网页)
 
*没有网页会被'选到'或者呈现在显示框中
 
*指派到下拉列表形式的名称是'page_id'
 
*允许你不选择任何网页(show_option_none)


  <?php wp_dropdown_pages(); ?>
  <?php wp_dropdown_pages(); ?>


===Dropdown with Submit Button===
===拥有提交按钮的下拉列表===
Displays a hierarchical page dropdown list in HTML form with a submit button.
 
将一个层级网页的下拉列表以HTML形式显示,拥有一个提交按钮。


&lt;li id="pages"&gt;
&lt;li id="pages"&gt;
   &lt;h2&gt;<?php _e('pages:'); ?>&lt;/h2&gt;
   &lt;h2&gt;<?php _e('pages:'); ?>&lt;/h2&gt;
     &lt;form action="<?php bloginfo('url'); ?>" method="get"&gt;
     &lt;form action="<?php bloginfo('url'); ?>" method="get"&gt;
第31行: 第39行:
  &lt;/li&gt;
  &lt;/li&gt;


== 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).
:* <tt>0</tt>  - Pages and sub-pages displayed in hierarchical (indented) form (Default).
:* <tt>-1</tt> - Pages in sub-pages displayed in flat (no indent) form.
:* <tt>1</tt>  - Show only top level Pages
:* <tt>2</tt>  - Value of 2 (or greater) specifies the depth (or level) to descend in displaying Pages.


; 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).
; depth (''integer''):这个参数控制了''wp_list_pages''产生的列表中包含有多少个层级的网页。默认值为''0'' (显示所有的网页,包括子网页)


; selected : (''integer'') Page ID of the page to be 'selected' or presented in the display box. Defaults to no page selected.


; 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:
:* <tt>0</tt>  - 网页和子网页以层级(嵌入式)方式显示(默认)。
 
:* <tt>-1</tt> - 子网页中的网页安装flat(非嵌入)的方式显示。
 
:* <tt>1</tt>  -只显示最高级别的网页
 
:* <tt>2</tt>  -2(或者更高的数字)的参数规定了显示网页时的可以下降的深度(层级)。
 
; child_of (''integer''):只显示一个单独网页的子网页;为网页使用ID作为参数值。默认为''0''(显示所有的网页)。
 
; selected : (''integer'') 在显示框中被'选上'或者显示的网页ID。默认为没有选择网页。
 
; echo (''boolean''):Toggles链接的总列表的显示或者返回列表作为HTML文本字符串,用于PHP。默认值是''1'' (显示总列表内容)。有效的参数值:
 
:* <tt>1 (true)</tt> - default
:* <tt>1 (true)</tt> - default
:* <tt>0 (false)</tt>
:* <tt>0 (false)</tt>


; name : (''string'') Name assigned to the dropdown form. Defaults to 'page_id'.
; name : (''string'') 指派给下拉列表形式的名称。默认为'page_id'
 
; show_option_none : (''string'') 致使下拉列表的HTML,允许你不选择任何网页。


; show_option_none : (''string'') Causes the HTML for the dropdown to allow you to select NONE of the pages.
;exclude  : (''string'')逗号将需要删除的类别IDs列表分开。例如,'exclude=4,12'指的是删除类别ID为4和12的类别不会显示/echoed或者返回。默认为不删除任何内容。


; 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.
==其它的参数 ==


==Other Parameters ==
函数get_pages的一些参数有可能被用来[[WordPress:Template_Tags/wp_dropdown_pages|wp_dropdown_pages]],但这并不是一定的。下面是get_pages参数的默认设置
It is possible, but not confirmed, some of the paramters for the function get_pages could be used for [[WordPress:Template_Tags/wp_dropdown_pages|wp_dropdown_pages]].  Here's the default settings for the get_pages parameters


<pre>
<pre>
第59行: 第75行:
'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '');
'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '');
</pre>
</pre>
== 相关的 ==
{{标签 总 标签}}


== Related ==
{{查询 字符串 标签 页底文字}}
{{Tag General Tags}}
 
{{Query String Tag Footer}}

2008年7月14日 (一) 15:33的最新版本

This article is [[WordPress::Category:Copyedits|marked]] as in need of editing. You can help Codex by editing it.

描述[ ]

在一个拥有递交按钮的挑选框(如 下拉列表)中显示一列网页。

用法[ ]

%%% <?php wp_dropdown_pages('arguments'); ?> %%%

例子[ ]

默认用法[ ]

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

默认情况下,用法显示:

  • 以层级方式(嵌入式)显示的网页和子网页。
  • 显示所有的网页(不局限于子网页)
  • 没有网页会被'选到'或者呈现在显示框中
  • 指派到下拉列表形式的名称是'page_id'
  • 允许你不选择任何网页(show_option_none)
<?php wp_dropdown_pages(); ?>

拥有提交按钮的下拉列表[ ]

将一个层级网页的下拉列表以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>

参数[ ]

depth (integer)
这个参数控制了wp_list_pages产生的列表中包含有多少个层级的网页。默认值为0 (显示所有的网页,包括子网页)。


  • 0 - 网页和子网页以层级(嵌入式)方式显示(默认)。
  • -1 - 子网页中的网页安装flat(非嵌入)的方式显示。
  • 1 -只显示最高级别的网页
  • 2 -2(或者更高的数字)的参数规定了显示网页时的可以下降的深度(层级)。
child_of (integer)
只显示一个单独网页的子网页;为网页使用ID作为参数值。默认为0(显示所有的网页)。
selected
(integer) 在显示框中被'选上'或者显示的网页ID。默认为没有选择网页。
echo (boolean)
Toggles链接的总列表的显示或者返回列表作为HTML文本字符串,用于PHP。默认值是1 (显示总列表内容)。有效的参数值:
  • 1 (true) - default
  • 0 (false)
name
(string) 指派给下拉列表形式的名称。默认为'page_id'。
show_option_none
(string) 致使下拉列表的HTML,允许你不选择任何网页。
exclude
(string)逗号将需要删除的类别IDs列表分开。例如,'exclude=4,12'指的是删除类别ID为4和12的类别不会显示/echoed或者返回。默认为不删除任何内容。

其它的参数[ ]

函数get_pages的一些参数有可能被用来wp_dropdown_pages,但这并不是一定的。下面是get_pages参数的默认设置

$defaults = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title',
'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '');

相关的[ ]

模板:标签 总 标签

模板:查询 字符串 标签 页底文字