p>
Show your posts, pages, and terms alphabetically in a Rolodex-, catalogue-, or directory-style list with the A-Z Listing plugin!
使用A-Z列表插件,在Rolodex,目录或目录样式列表中按字母顺序显示您的帖子,页面和术语! p>
The plugin has a short-code for the list, and a widget so you can link to the list from anywhere on your site.
该插件具有用于该列表的短代码和一个小部件,因此您可以从网站上的任何位置链接到该列表。
If a letter doesn’t have any pages then the widget will display the letter unlinked.
如果字母没有任何页面,则小部件将显示未链接的字母。
The list page will omit the display for that letter entirely.
列表页面将完全省略该字母的显示。 p>
Show posts from any or multiple post types including the in-built posts and pages.
显示任何或多种帖子类型的帖子,包括内置帖子和页面。
Also supported are post-types from plugins like WooCommerce products.
WooCommerce产品等插件的帖子类型也受支持。
Alternatively, show terms like categories or tags.
或者,显示诸如类别或标签之类的术语。 p>
short-code
短代码 h3>
The plugin supplies a short-code for the full A-Z listing allowing use without modifying your theme’s templates.
该插件提供了完整的A-Z列表的短代码,允许您在不修改主题模板的情况下使用它。 p>
Basic usage is as follows:
基本用法如下: p>
[a-z-listing] [a-z-listing]
code> pre>
To specify a post-type to display instead of page
then use, e.g.
要指定要显示的帖子类型而不是 page code>,然后使用,例如post
:
post code>: p>[a-z-listing display="posts" post-type="post"] [a-z-listing display =“ posts” post-type =“ post”]
code> pre>
To filter the posts by a term from a taxonomy:
要按分类法中的术语过滤帖子: p>
[a-z-listing display="posts" taxonomy="category" terms="my-term-slug"] [a-z-listing display =“ posts” taxonomy =“ category” terms =“ my-term-slug”]]
code> pre>
To display pages that are direct children of the page with ID 24
:
要显示属于ID为 24 code>的页面的直接子页面: p>[a-z-listing display="posts" post-type="page" parent-post="24"] [a-z-listing display =“ posts” post-type =“ page” parent-post =“ 24”]
code> pre>
To display pages that are children of any depth below the page with ID 24
:
要显示ID为 24 code>的页面下方任意深度的子页面: p>[a-z-listing display="posts" post-type="page" parent-post="24" get-all-children="yes"] [a-z-listing display =“ posts” post-type =“ page” parent-post =“ 24” get-all-children =“ yes”]
code> pre>
To show terms from a taxonomy instead of posts and pages, e.g.
显示分类法中的术语,而不是帖子和页面,例如
Terms from the Categories
taxonomy:
Categories code>分类中的术语: p>[a-z-listing display="terms" taxonomy="category"] [a-z-listing display =“ terms” taxonomy =“ category”]
code> pre>
To show terms from the Categories
taxonomy that are direct children of the term with ID of 42
:
要显示 Categories code>分类法中的术语,这些术语是ID为 42 code>的术语的直接子代: p>[a-z-listing display="terms" taxonomy="category" parent-term="42"] [a-z-listing display =“ terms” taxonomy =“ category” parent-term =“ 42”]
code> pre>
To show terms from the Categories
taxonomy that are children of any depth in the tree below the term with ID of 42
:
要显示 Categories code>分类中的术语,这些术语在ID为 42 code>的术语下方的树中是任意深度的子代: p>[a-z-listing display="terms" taxonomy="category" parent-term="42" get-all-children="yes"] [a-z-listing display =“ terms” taxonomy =“ category” parent-term =“ 42” get-all-children =“ yes”]
code> pre>
To override the alphabet used by the plugin:
要覆盖插件使用的字母: p>
[az-listing display="posts" alphabet="Aa,Bb,Cc,Dd,Ee,Ff,Gg,Hh,Ii,Jj,Kk,Ll,Mm,Nn,Oo,Pp, [az-listing display =“ posts” Alphabet =“ Aa,Bb,Cc,Dd,Ee,Ff,Gg,Hh,Ii,Jj,Kk,Ll,Mm,Nn,Oo,Pp, Qq,Rr,Ss,Tt,Uu,Vv,Ww,Xx,Yy,Zz"]
Qq,Rr,Ss,Tt,Uu,Vv,Ww,Xx,Yy,Zz“]
code> pre>
To add numbers to the listing:
要在列表中添加数字: p>
[a-z-listing display="posts" numbers="after"] [a-z-listing display =“ posts” numbers =“ after”]
code> pre>
The numbers can also be shown before the alphabet:
数字也可以显示在字母之前: p>
[a-z-listing display="posts" numbers="before"] [a-z-listing display =“ posts” numbers =“ before”]
code> pre>
You can group the numbers into a single collection for all posts beginning with a numeral:
对于所有以数字开头的帖子,您可以将数字分组到一个集合中: p>
[a-z-listing numbers="after" group-numbers="yes"] [a-z-listing编号=“ after” group-numbers =“ yes”]
code> pre>
To group the alphabet letters into a range:
要将字母分组为一个范围: p>
[a-z-listing grouping="3"] [a-z-listing grouping =“ 3”]
code> pre>
** The arguments are all optional **
**参数都是可选的** p>
Common options
常用选项 h4>
display
: specifies whether to display posts or terms from a taxonomy.-
display code>:指定是显示分类法中的帖子还是术语。- Default value:
posts
. - 默认值:
帖子 code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be set to either
posts
or terms
. - 必须设置为
posts code>或 terms code>。 li>- Any value other than
posts
or terms
will default to displaying posts. - 除了
posts code>或 terms code>以外的任何值都将默认显示职位。 li>
ul>
li>
numbers
: appends or prepends numerals to the alphabet.-
数字 code>:将数字附加或添加到字母表上。- Default value:
unset
. - 默认值:
未设置 code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be set to either
before
or after
. - 必须设置为
之前 code>或之后 code>。 li>- Any value other than
before
or after
will default to appending numerals to the alphabet. - 除
before code>或 after code>之后的任何值都将默认为在字母表中附加 strong>数字。 li>
ul>
li>
grouping
: tells the plugin if and how to group the alphabet.-
分组 code>:告诉插件是否以及如何对字母进行分组。- Default value:
unset
. - 默认值:
未设置 code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be set to any positive number greater than
1
or the value numbers
. - 必须设置为大于
1 code>或值为 numbers code>的任何正数。 li>- Any value other than a positive number or the value
numbers
will default to disabling all grouping functionality. - 除正数或
numbers code>之外的任何其他值都将默认禁用所有分组功能。 li>- When set to a number higher than
1
the listing will group letters together into ranges. - 当设置为大于
1 code>的数字时,列表会将字母分组到范围内。 li>- For example, if you chose
3
then a Latin alphabet will group together A
, B
, and C
- 例如,如果您选择
3 code>,则拉丁字母会将 A code>, B code>和 C code组合在一起> into AC
.
>进入 AC code>。Likewise for D-F
, G-I
and so-on.
对于 D-F code>, G-I code>等也是如此。 li>- When using this setting, if numbers are also shown via the
numbers="before"
or numbers="after"
attribute then they will be shown as a single separate - 使用此设置时,如果还通过
numbers =“ before” code>或 numbers =“ after” code>属性显示数字,则它们将显示为单独的一个group 0-9
.
组 0-9 code>。 li>- When set to the value
numbers
it will group numerals into a single group 0-9
. - 设置为值
numbers code>时,它将把数字分组为单个组 0-9 code>。 li>- This requires the numbers to be displayed via the
numbers="before"
or numbers="after"
attributes. - 这需要通过
numbers =“ before” code>或 numbers =“ after” code>属性显示数字。 li>
ul>
li>
group-numbers
: tells the plugin to group all items beginning with a numeral into a single collection.-
group-numbers code>:告诉插件将以数字开头的所有项目分组为一个集合。- Default value:
false
. - 默认值:
false code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be set to
true
, yes
, on
, or 1
to group items beginning with a numeral - 必须设置为
true code>, yes code>, on code>或 1 code>,才能对以数字开头的项目进行分组in a single collection.
在一个集合中。
All other values will keep the default behaviour.
所有其他值将保留默认行为。 li>
ul>
li>
alphabet
: allows you to override the alphabet that the plugin uses.-
字母 code>:允许您覆盖插件使用的字母。- Default value:
unset
. - 默认值:
未设置 code>。 li>- When this attribute is not defined, the plugin will either use the untranslated default, or if glotpress includes a translation for your site's language as set in
Admin -> Settings -> Site Language
it will use that translation. “> glotpress 包括在 Admin->设置->网站语言 code>中设置的网站语言翻译,它将使用该翻译。 li>- The current untranslated default is:
AÁÀÄÂaáàäâ,Bb,Cc,Dd,EÉÈËÊeéèëê,Ff,Gg,Hh,IÍÌÏÎiíìïî,Jj,Kk,Ll,Mm,Nn,OÓÒÖÔoóòöô,Pp,Qq,Rr,Ssß,- 当前未翻译的默认值为:
AÁÀÄÂaááàäâ,Bb,Cc,Dd,EÉÈËÊeéèëë,Ff,Gg,Hh,IÍÌÏÎiíïïî,Jj,Kk,Ll,Mm,Nn,OÓÒÖÔoosöö,Pp,QqR Tt,UÚÙÜÛuúùüû,Vv,Ww,Xx,Yy,Zz
. Tt,UÚÙÜÛuúùüû,Vv,Ww,Xx,Yy,Zz code>。 li>
- Accepts a single line of letters/symbols, which need to be separated via the comma character
,
. - 接受单行字母/符号,需要通过逗号分隔
, code>。 li>- Including more than one letter/symbol in each group will display posts starting with any of those under the same section.
- 每组中包含不止一个字母/符号将显示以同一部分下的任何内容开头的帖子。 li>
- The first letter/symbol in each group is used as the group’s heading when displayed on your site.
- 每个组中的第一个字母/符号在您的网站上显示时均用作该组的标题。 li>
ul>
li>
ul>
Posts options
发布选项 h4>
post-type
: sets the listing to show a specific post-type.-
帖子类型 code>:设置列表以显示特定的帖子类型。- Default value:
page
. - 默认值:
page code>。 li>- Multiple post-types may be specified by separating with commas (
,
) e.g. - 可以使用逗号(
, code>)分隔多个后缀类型,例如post-type="page,post"
.
post-type =“ page,post” code>。 li>- Must be the
slug
of the post-type(s). - 必须是帖子类型的
slug code>。 li>
ul>
li>
parent-post
: sets the parent post that all displayed posts must be descended from.-
parent-post code>:设置父帖子,所有显示的帖子都必须来自该父帖子。- Default value:
unset
. - 默认值:
未设置 code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be the
ID
of the parent post. - 必须是父帖子的
ID code>。 li>- Add
get-all-children="yes"
to also include all descendants of any depth below the parent post. - 添加
get-all-children =“ yes” code>,以包括父帖子下方任何深度的所有后代。 li>
ul>
li>
exclude-posts
: remove these posts from the list.-
排除帖子 code>:从列表中删除这些帖子。- Default value:
unset
. - 默认值:
未设置 code>。 li>- Multiple posts may be specified by separating by commas:
,
. - 可以用逗号分隔多个帖子:
, code>。 li>- Must be the
ID
of the post(s). - 必须是帖子的
ID code>。 li>
ul>
li>
taxonomy
: sets the taxonomy containing the terms specified in the terms=""
option.-
分类标准 code>:设置包含 terms =“” code>选项中指定的术语的分类标准。- Default value:
unset
. - 默认值:
未设置 code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be the
slug
of the taxonomy. - 必须是分类法的
slug code>。 li>
ul>
li>
terms
: sets the taxonomy terms for filtering posts.-
条款 code>:设置用于过滤帖子的分类条款。- Default value:
unset
. - 默认值:
未设置 code>。 li>- The taxonomy must also be specified in
taxonomy
. - 还必须在
taxonomy code>中指定分类法。 li>- Multiple terms may be specified by separating with commas:
,
. - 可以用逗号分隔多个术语:
, code>。 li>- Must be the
slug
of the term(s). - 必须是术语的
slug code>。 li>
ul>
li>
ul>
Terms options
条款选项 h4>
taxonomy
: sets the taxonomy to display terms from in the listing.-
分类法 code>:设置分类法以显示列表中的术语。- Default value:
unset
. - 默认值:
未设置 code>。 li>- Multiple taxonomies may be specified by separating with commas:
,
. - 可以用逗号分隔多个分类法:
, code>。 li>- Must be the
slug
of the taxonomy. - 必须是分类法的
slug code>。 li>
ul>
li>
terms
: sets the taxonomy terms to include in the listing.-
条款 code>:设置分类条款以包含在列表中。- Default value:
unset
. - 默认值:
未设置 code>。 li>- The taxonomy must also be specified in
taxonomy
. - 还必须在
taxonomy code>中指定分类法。 li>- Multiple terms may be specified by separating with commas:
,
. - 可以用逗号分隔多个术语:
, code>。 li>- Must be the
ID
of the term(s). - 必须是术语的
ID code>。 li>- Cannot be used with
exclude-terms=""
. - 不能与
exclude-terms =“” code>一起使用。 li>
ul>
li>
exclude-terms
: sets the terms to exclude from display.-
排除条款 code>:设置要从显示中排除的条款。- Default value:
unset
. - 默认值:
未设置 code>。 li>- The taxonomy must also be specified in
taxonomy
. - 还必须在
taxonomy code>中指定分类法。 li>- Multiple terms may be specified by separating with commas:
,
. - 可以用逗号分隔多个术语:
, code>。 li>- Must be the
ID
of the term(s). - 必须是术语的
ID code>。 li>- Cannot be used with
terms=""
. - 不能与
terms =“” code>一起使用。 li>
ul>
li>
parent-term
: set the parent that all displayed terms must be descended from.-
parent-term code>:设置所有显示的术语都必须源自的父级。- Default value:
unset
. - 默认值:
未设置 code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be the
slug
of the parent term. - 必须是父项的
slug code>。 li>- Add
get-all-children="yes"
to also include all descendants of any depth below the parent term. - 添加
get-all-children =“ yes” code>也包括父项以下任意深度的所有后代。 li>
ul>
li>
get-all-children
: when a parent term is chosen this option is used to show all children of any depth or only direct children.-
获取所有子项 code>:选择父项时,此选项用于显示所有深度的子项或仅显示直接子项。- Default value:
false
. - 默认值:
false code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be set to
true
, yes
, on
, or 1
to include all children of any depth - 必须设置为
true code>, yes code>, on code>或 1 code>,以包括所有深度的所有子级.
。
Any value other will use the default behaviour of only showing direct children.
其他任何值都将使用仅显示直接子级的默认行为。 li>
ul>
li>
hide-empty-terms
: hide terms that have no posts associated.-
hide-empty-terms code>:隐藏没有相关帖子的字词。- Default value:
false
. - 默认值:
false code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be set to
true
, yes
, on
, or 1
to hide the empty terms. - 必须设置为
true code>, yes code>, on code>或 1 code>,以隐藏空术语。Any other value will use the default behaviour of showing all terms.
其他任何值都将使用显示所有术语的默认行为。 li>
ul>
li>
ul>
Internal-use options for completeness
内部使用选项的完整性 h4>
** You should not need to touch these, as they are meant for internal use by the plugin only**
**您无需触摸它们,因为它们仅供插件内部使用** p>
target
: the default target for a listing that doesn’t show any items.-
目标 code>:不显示任何项目的列表的默认目标。- Default value:
unset
. - 默认值:
未设置 code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be set to a URL which will be used as the target for the letters’ hyperlinks.
- 必须将其设置为URL,以用作字母超链接的目标。 li>
ul>
li>
return
: what type of listing to show, either listing
or letters
.-
return code>:要显示的列表类型, listing code>或 letters code>。- Default value:
listing
. - 默认值:
列表 code>。 li>- May only contain one value.
- 只能包含一个值。 li>
- Must be set to either
listing
to display the default view, or letters
to show only the letters without any items (posts or terms). - 必须设置为
listing code>以显示默认视图,或者设置为 letters code>以仅显示不带任何项目(帖子或术语)的字母。 li>
ul>
li>
ul>
PHP
PHP h3>
Synopsis
简介 h4>
<?phpthe_a_z_listing( $query );
the_a_z_listing($ query);
// or
// 要么
get_the_a_z_listing( $query );
get_the_a_z_listing($ query);
?>
?>
code> pre>
Where $query
is one of the following:
其中 $ query code>是以下之一: p>- any valid
WP_Query
parameter array - 任何有效的
WP_Query code>
参数数组 li> - a
WP_Query
object formed from new WP_Query();
- 由
new WP_Query(); code> li>形成的 WP_Query code>对象- any valid
get_pages()
parameter array. - 任何有效的
get_pages() code>
参数数组。This array must include a child_of
key or a parent
key to tell the plugin that it is a get_pages()
query
该数组必须包含一个 child_of code>键或一个 parent code>键,以告知插件它是一个 get_pages() code>查询 li>- a single string containing a taxonomy which will switch the listing to display terms from that taxonomy instead of posts
- 包含分类法的单个字符串,它将切换列表以显示该分类法中的术语而不是帖子 li>
ul>
Reference
参考 h4>
Full API documentation is available at A-Z-Listing Reference
完整的API文档可在 A-Z列表参考 p>中找到。
Multiple Column Output
多列输出 h3>
Multiple column layout is the default on wide screens.
多列布局是宽屏上的默认设置。
A letter’s group of items must contain at least 15 items to create two or more columns.
一个字母的项目组必须包含至少15个项目才能创建两个或更多列。
This is to provide a more aesthetically pleasing view when a list is short with only a few items.
当列表短而只包含少量项目时,这将提供一个更加美观的视图。 p>
Templates and Theming
模板和主题 h3>
The plugin allows the site owner, developer, or themer to provide custom templates for the A-Z Listing output.
该插件允许网站所有者,开发人员或开发商为A-Z列表输出提供自定义模板。 p>
NOTE: These functions have changed name and method of access in 1.0.0. 注意:这些功能已更改1.0.0中的名称和访问方法。We have dropped the _a_z_
moniker in the function name and within the template file they are accessed via the $a_z_listing
object.
The former function names are still accessible,
我们已经在函数名称中删除了 _a_z _ code>名称,并在模板文件中通过 $ a_z_listing code>对象对其进行了访问。 em>以前的函数名称仍然可以访问,but are largely deprecated.
但已被弃用。 p>
To add a template to your theme, you need a file similar to the templates/a-z-listing.php
file in the plugin folder.
要将模板添加到主题,您需要一个类似于plugin文件夹中的 templates / a-z-listing.php code>文件的文件。Your copy needs to be placed within your theme at the theme root directory and called az-listing.php
or az-listing-section.php
(where -section您需要将副本放置在主题的根目录下的主题中,并命名为 az-listing.php code>或 az-listing-section.php code>(其中 -section
is an optional top-level page slug for the section-targeting feature).
code>是针对部分定位功能的可选顶级页面插件。 p>
The Loop
循环 h4>
The theme system this plugin implements is very similar to the standard WordPress loop
此插件实现的主题系统非常非常 em>,类似于标准WordPress循环 a >, with a few added bits.
>,并增加了一些内容。 p>
Important functions to use in your template are as follows:
要在模板中使用的重要功能如下: p>
$a_z_query->the_letters()
prints the full alphabet, and links the letters that have posts to their section within the index page.-
$ a_z_query-> the_letters() code>打印完整字母,并将带有帖子的字母链接到索引页面中的相应部分。 li>$a_z_query->have_letters()
returns true or false depending on whether there are any letters left to loop-through.-
$ a_z_query-> have_letters() code>返回true或false,具体取决于是否还有要循环通过的字母。This is part of the Letter Loop.
这是字母循环的一部分。 li>
$a_z_query->have_items()
behaves very similarly to Core’s have_posts()
function.-
$ a_z_query-> have_items() code>的行为与Core的 have_posts() code>函数非常相似。It is part of the Item Loop.
它是项目循环的一部分。 li>
$a_z_query->the_letter()
similar to Core’s the_post()
, this will set-up the next iteration of the A-Z Listing’s Letter Loop.-
$ a_z_query-> the_letter() code>与Core的 the_post() code>类似,这将设置A-Z列表的Letter循环的下一个迭代。This needs to wrap-around the Item Loop.
这需要包装项目循环。 li>
$a_z_query->the_item()
similar to Core's the_post()
, this will set-up the next iteration of the AZ Listing's Item Loop, the same way the-
$ a_z_query-> the_item() code>与Core的 the_post() code>类似,这将设置AZ Listing的Item Loop的下一个迭代,方法与normal WordPress Loop works.
正常的WordPress Loop作品。
This needs to be within the Letter Loop.
这必须在字母循环内 em>。 li>
ul>
When you are within the Item Loop you may utilise all in-built WordPress Core post-related functions such as the_content()
.
在项目循环中时,您可以利用所有内置的WordPress Core帖子相关功能,例如 the_content() code>。Note that titles and permalinks have helper functions to cope with the A-Z Listing showing taxonomy terms (see the next section).
请注意,标题和永久链接具有帮助功能,以应付显示分类术语的A-Z列表(请参阅下一节)。 p>
I advise that you start with a copy of the default template template when customizing your own version.
我建议您在定制自己的版本时从默认模板模板的副本开始。
The supplied templates show the usage of most of the functions this plugin provides.
提供的模板显示了此插件提供的大多数功能的使用。 p>
Helper functions
辅助功能 h4>
The plugin supports displaying taxonomy terms as though each term were a post.
该插件支持显示分类术语,就像每个术语都是帖子一样。
This means that the WordPress functions related to posts such as the_title()
and the_permalink()
are unreliable.
这意味着与诸如 the_title() code>和 the_permalink() code>之类的帖子相关的WordPress功能不可靠。We have therefore added helper functions which will return or print the correct output for the item.
因此,我们添加了辅助函数,这些函数将返回或打印该项目的正确输出。 p>
NOTE: These functions have changed name and method of access in 1.0.0. 注意:这些功能已更改1.0.0中的名称和访问方法。We have dropped the
a_z moniker in the function name and within the template file they are accessed via the $a_z_listing
object.
我们将 em> a_z em>标记放在函数名称中,并在模板文件中通过 $ a_z_listing code>对象访问它们。The previous function names are still accessible, but are largely deprecated.
以前的函数名称仍可访问,但已不推荐使用。 p>
These helper functions cope with the dual usage of the plugin supporting both WP_Query
-based (returning WP_Post
objects) and Taxonomy Terms (returning WP_Term
这些帮助程序功能可满足支持基于 WP_Query code>的(返回 WP_Post code>对象)和分类术语(返回 WP_Term code)的插件的双重使用> objects) listings.
>对象)列表。
These are:
这些是: p>
$a_z_query->the_title()
– prints the current item’s Title-
$ a_z_query-> the_title() code> –打印当前项目的标题 li>$a_z_query->get_the_title()
returns the current item’s Title but does not print it directly-
$ a_z_query-> get_the_title() code>返回当前项目的标题,但不直接打印 li>$a_z_query->the_permalink()
prints the current item’s Permalink-
$ a_z_query-> the_permalink() code>打印当前项目的Permalink li>$a_z_query->get_the_permalink()
returns the current item’s Permalink but does not print it directly-
$ a_z_query-> get_the_permalink() code>返回当前项目的“永久链接”,但不直接打印 li>
ul>