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

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
{{Copyedit}}
== Description ==
{{Copyedit}}
{{Copyedit}}
==描述==
==描述==
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'); ?> %%%


== 用法 ==
%%% <?php wp_下拉列表_网页('参数'); ?> %%%
== Examples ==
===Default Usage===
== 例子 ==
== 例子 ==
===默认用法===
===默认用法===
第23行: 第12行:
$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>
<pre>
$默认 = array('depth' => 0, 'child_of' => 0, '挑选的' => 0,
'echo' => 1,'名称' => '网页_id', '显示_选项_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'
*指派到下拉列表形式的名称是'page_id'


*指派到下拉列表形式的名称是'网页_id'
*允许你不选择任何网页(show_option_none)
 
* Allows you to select NONE of the pages (show_option_none)
 
*允许你不选择任何网页(不显示_任何_选项)


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


<?php wp_下拉列表_网页(); ?>
===拥有提交按钮的下拉列表===
 
===Dropdown with Submit Button===
 
===拥有递交按钮的下拉列表===
 
 
Displays a hierarchical page dropdown list in HTML form with a submit button.


将一个层级网页的下拉列表以HTML形式显示,拥有一个递交按钮。
将一个层级网页的下拉列表以HTML形式显示,拥有一个提交按钮。
 
&lt;li id="pages"&gt;
  &lt;h2&gt;<?php _e('pages:'); ?>&lt;/h2&gt;
    &lt;form action="<?php bloginfo('url'); ?>" method="get"&gt;
    <?php wp_dropdown_pages(''); ?>
    &lt;input type="submit" name="submit" value="view" /&gt;
    &lt;/form&gt;
&lt;/li&gt;


&lt;li id="pages"&gt;
&lt;li id="pages"&gt;
第80行: 第39行:
  &lt;/li&gt;
  &lt;/li&gt;


== Parameters ==
== 参数 ==
== 参数 ==


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


; 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'' (显示所有的网页,包括子网页)。
:* <tt>0</tt>  - Pages and sub-pages displayed in hierarchical (indented) form (Default).
:* <tt>0</tt>  -网页和子网页以层级(嵌入式)方式显示(默认)。


:* <tt>-1</tt> - Pages in sub-pages displayed in flat (no indent) form.
:* <tt>0</tt> - 网页和子网页以层级(嵌入式)方式显示(默认)。


:* <tt>-1</tt> -子网页中的网页安装flat(非嵌入)的方式显示。
:* <tt>-1</tt> - 子网页中的网页安装flat(非嵌入)的方式显示。
 
:* <tt>1</tt>  - Show only top level Pages


:* <tt>1</tt>  -只显示最高级别的网页
:* <tt>1</tt>  -只显示最高级别的网页
:* <tt>2</tt>  - Value of 2 (or greater) specifies the depth (or level) to descend in displaying Pages.


:* <tt>2</tt>  -2(或者更高的数字)的参数规定了显示网页时的可以下降的深度(层级)。
:* <tt>2</tt>  -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).
; child_of (''integer''):只显示一个单独网页的子网页;为网页使用ID作为参数值。默认为''0''(显示所有的网页)。
 
;子_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:
; selected : (''integer'') 在显示框中被'选上'或者显示的网页ID。默认为没有选择网页。


; echo (''boolean''):Toggles链接的总列表的显示或者返回列表作为HTML文本字符串,用于PHP。默认值是''1'' (显示总列表内容)。有效的参数值:
; echo (''boolean''):Toggles链接的总列表的显示或者返回列表作为HTML文本字符串,用于PHP。默认值是''1'' (显示总列表内容)。有效的参数值:
第119行: 第61行:
:* <tt>0 (false)</tt>
:* <tt>0 (false)</tt>


:* <tt>1 (正确的)</tt> - 默认的
; name : (''string'') 指派给下拉列表形式的名称。默认为'page_id'。
:* <tt>0 (错误的)</tt>
 
; 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.
; show_option_none : (''string'') 致使下拉列表的HTML,允许你不选择任何网页。


; 删除 : (''string'')逗号将需要删除的类别IDs列表分开。例如,'删除=4,12'指的是删除类别ID为4和12的类别不会显示/echoed或者返回。默认为不删除任何内容。
;exclude  : (''string'')逗号将需要删除的类别IDs列表分开。例如,'exclude=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 [[WordPress:Template_Tags/wp_dropdown_pages|wp_dropdown_pages]].  Here's the default settings for the get_pages parameters
函数get_pages的一些参数有可能被用来[[WordPress:Template_Tags/wp_dropdown_pages|wp_dropdown_pages]],但这并不是一定的。下面是get_pages参数的默认设置
函数得到_网页的一些参数有可能被用来[[WordPress:Template_Tags/wp_dropdown_pages|wp_下拉列表_网页]],但这并不是一定的。下面是得到_网页参数的默认设置


<pre>
<pre>
第144行: 第75行:
'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '');
'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '');
</pre>
</pre>
<pre>
$默认 = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title',
'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', '作者' => '');
</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' => '');

相关的[ ]

模板:标签 总 标签

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