wordpress分类_扩展WordPress分类法
wordpress分类
什么是WordPress分类法/自定义分类法? (What Are WordPress Taxonomies/Custom Taxonomies?)
Taxonomies are essentially a way to group together sets of information.
分类法本质上是将信息集组合在一起的一种方法。
As covered in my previous article on Custom WordPress Taxonomies, WordPress uses its in-built taxonomies categories
and tags
to provide grouping for your content types and by default applies these to the posts
content type. These taxonomies consist of one or more terms
which are basically names used to group your items together.
如我上一篇有关“自定义WordPress分类法”的文章所述 ,WordPress使用其内置分类法categories
和tags
为您的内容类型提供分组,默认情况下将其应用于posts
内容类型。 这些分类法由一个或多个terms
组成,这些terms
基本上是用于将项目组合在一起的名称。
While the standard taxonomies may be fine, sometimes you may need additional ways to group content together which is logical to your needs. That is where custom taxonomies can prove exceptionally useful.
尽管标准分类法可能不错,但有时您可能需要其他方式将内容分组在一起,这符合您的需求。 这就是定制分类法可以证明非常有用的地方。
Custom taxonomies let you create your own names and structures to organise your posts. You may create a new taxonomy called grade_ranking
which will handle the ranking of your posts by a grade score such as pass
,credit
,distinction
and high distinction
.
自定义分类法使您可以创建自己的名称和结构来组织帖子。 您可以创建一个新的分类名为grade_ranking
将处理您的帖子一年级的排名分数,如pass
, credit
, distinction
和high distinction
。
分类标准信息 (Taxonomy Standard Information)
When you define taxonomies you determine if it will be hierarchical
or non-hierarchial
. This determines what information will be collected about your taxonomy.
定义分类法时,您将确定它是hierarchical
还是non-hierarchial
。 这确定了将收集有关您的分类法的哪些信息。
hierarchical
taxonomies act similar to categories
, allowing different levels of terms (you can assign parents and children to terms).Non-hierarchical
taxonomies act like tags
where all terms are of the same flat level.
hierarchical
分类法的作用类似于categories
,允许使用不同级别的术语(可以为术语分配父母和子女)。 Non-hierarchical
分类法的作用类似于tags
,其中所有术语均处于同一平面。
Your custom taxonomy will let you enter the following pieces of information for each of your terms
您的自定义分类法将使您为每个术语输入以下信息
-
Name
名称
- defines the name used for the term itself, this is shown to the end user. Applied to both categories and tags 定义用于术语本身的名称,这将显示给最终用户。 应用于类别和标签
-
Slug
ug
- determines the url used for the term (generally lower case and spaces replaced by a dash character). Applies to both categories and terms 确定用于该术语的url(通常为小写字母,并用破折号代替空格)。 适用于类别和术语
-
Parent
父母
- Let you determine if your term will be a top level parent term or if it will be a child term. Applies only to hierarchical taxonomies such as categories 让您确定您的术语将是*父术语还是子术语。 仅适用于分层分类法,例如类别
-
Description
描述
- A brief description of what this term in. This is shown on the term listing page (when you click to view on the term itself) 该术语的简要说明。这显示在术语列表页面上(当您单击以查看术语本身时)
That is the entirety of what WordPress will provide for you in regards to your terms.
这就是WordPress将根据您的条款为您提供的全部内容。
扩展分类法 (Extending Taxonomies)
While the default information may be all that you need for your taxonomy, you may want to save additional information which you can use elsewhere on your website.
虽然默认信息可能是分类所需的全部信息,但您可能希望保存其他信息,以供其他使用。
WordPress offers are series of hooks
that can be used to modify the administration areas of your taxonomy screen and help you in the process of saving additional information.
WordPress提供的hooks
系列可用于修改分类法屏幕的管理区域,并在保存其他信息的过程中为您提供帮助。
For our tutorial, we will be extending the default category
taxonomy. You can easily extend both the in-built taxonomies or taxonomies you have created yourself, but for simplicity we will be modifying an existing taxonomy.
对于我们的教程,我们将扩展默认category
分类法。 您可以轻松扩展内置分类法或您自己创建的分类法,但为简单起见,我们将修改现有分类法。
我们从哪里开始? (Where do we start?)
WordPress will provide two primary ways for you to create the terms of your taxonomies:
WordPress将为您提供两种创建分类法术语的主要方法:
- Creating them via the taxonomy administration screen 通过分类管理屏幕创建它们
- On the fly while editing a post type that your taxonomy is bound to. 在编辑分类法绑定到的帖子类型时,即时进行操作。
For example, you can create terms for your category taxonomy such featured
and sponsored
in either the category administration menu (by defining the name, slug, parent description etc) or by creating them directly inside your post or page (by using the category meta box and adding a new category dynamically).
例如,你可以这样创建您的类别分类术语featured
和sponsored
在任一类管理菜单(通过定义名称,蛞蝓,父母描述等)或直接在您的文章或页面内创建它们(使用类别元框并动态添加新类别)。
Since we will want to save additional information about our terms, we will be using the taxonomy administration screens as they provide the best way to add, edit and remove terms.
由于我们要保存有关术语的其他信息,因此我们将使用分类管理屏幕,因为它们提供了添加,编辑和删除术语的最佳方法。
需要修改什么? (What needs to be modified?)
When you work with taxonomies you will be interacting with both the add
and edit
administration screens. These screens handle the process of adding a new term and editing an existing term respectively. WordPress provides a series of hooks
that are made to help you hook into specific functionality and provide you with an easy way to modify core functionality.
使用分类法时,您将同时与add
和edit
管理屏幕进行交互。 这些屏幕分别处理添加新术语和编辑现有术语的过程。 WordPress提供了一系列hooks
,可帮助您挂钩特定功能,并为您提供一种轻松的方式来修改核心功能。
Since we will be saving additional information we will need to modify both screens so that we can attach, collect and interact with our saved information.
由于我们将保存其他信息,因此需要修改两个屏幕,以便我们可以附加,收集并与保存的信息进行交互。
In this tutorial we will be adding additional form elements so we can collect more information about our categories. To this end we will capture the following elements:
在本教程中,我们将添加其他表单元素,以便我们可以收集有关类别的更多信息。 为此,我们将捕获以下元素:
- text 文本
- textarea 文本区域
- select 选择
- checkbox 复选框
These are the most common form elements and should help to give you a better understanding about how you can extend taxonomies to save additional information.
这些是最常见的表单元素,应该有助于您更好地理解如何扩展分类法以保存其他信息。
修改添加类别管理菜单 (Modifying the add category administration menu)
The first place we will need to modify will be the add category administration menu. This menu is generally where you will be adding all of your categories and where we will need to save additional information.
我们需要修改的第一个地方是添加类别管理菜单。 通常,您可以在此菜单中添加所有类别,还需要保存其他信息。
We need to use the category_add_form_fields
hook.
我们需要使用category_add_form_fields
挂钩。
The category_add_form_fields
hook is used to add additional information to the category administration screen. This hook takes in a single parameter which is the name of the taxonomy itself. This hook allows us to add additional information to the add category screen, so first we will need to define a function that displays a few fields for us to save. The following code should go in your theme’s functions.php file (or another file that you use for your custom code)
category_add_form_fields
挂钩用于将其他信息添加到类别管理屏幕。 该钩子接受一个参数,该参数是分类法本身的名称。 这个钩子使我们能够向添加类别屏幕添加其他信息,因此首先我们需要定义一个显示一些字段供我们保存的函数。 以下代码应放在主题的functions.php文件(或用于自定义代码的另一个文件)中
function add_extra_fields_to_category($taxonomy_name){
?>
<div class="form-field">
<label for="category-text">Category Text Field</label>
<input type="text" name="category-text" id="category-text"/>
<p>This is a text field </p>
</div>
<div class="form-field">
<label for="category-textarea">Category Textarea Field</label>
<textarea name="category-textarea" id="category-textarea"></textarea>
<p>This is a textarea field </p>
</div>
<div class="form-field">
<label for="category-select">Category Select Field</label>
<select name="category-select" id="category-select">
<option value="select-value-one"> Value One </option>
<option value="select-value-two"> Value Two </option>
</select>
<p>This is a select field </p>
</div>
<div>
<label for="category-radio-value-one">Category Radio Value One</label>
<input type="radio" name="category-radio" id="category-radio-value-one" value="category-radio-value-one"/>
<label for="category-radio-value-two">Category Radio Value Two</label>
<input type="radio" name="category-radio" id="category-radio-value-two" value="category-radio-value-two"/>
<p>This is a radio field </p>
</div>
<?php
}
Now that we have our function defined, all we need to do is connect it to our category_add_form_fields
hook and it will activate as soon as the add category screen is displayed. We will do this by calling the add_action()
function.
现在我们已经定义了函数,我们所要做的就是将其连接到我们的category_add_form_fields
钩子,它会在显示添加类别屏幕时立即**。 我们将通过调用add_action()
函数来实现。
add_action('category_add_form_fields','add_extra_fields_to_category');
add_action('category_add_form_fields','add_extra_fields_to_category');
Once you have completed this, your category administration screen should show the additional fields you defined in your function. Mine looks as follows:
完成此操作后,类别管理屏幕将显示您在函数中定义的其他字段。 我的看起来如下:
As a side-note, when you define your fields to add to your screen you will generally wrap them within a form-field
class, this ensures that the contained input elements span the full width of the screen. As you can see in our example I have let this class enabled except for the radio buttons. We wouldn’t want our radio buttons to span full width (as it would look strange).
附带说明一下,当您定义要添加到屏幕的字段时,通常会将它们包装在一个form-field
类中,这样可以确保所包含的输入元素跨越屏幕的整个宽度。 正如您在我们的示例中看到的那样,除了单选按钮之外,我让此类启用。 我们不希望我们的单选按钮跨越整个宽度(因为这看起来很奇怪)。
In addition, if you add the class form-required
it will ensure that you element is entered before adding the new term.
另外,如果您添加form-required
的类,则将确保在添加新术语之前输入了您的元素。
保存我们的新类别信息 (Saving our new category information)
Now that we have modified the add category screen, we need to save our additional information so that we can use it.
现在,我们已经修改了添加类别屏幕,我们需要保存其他信息,以便可以使用它。
We will need to attach a function to another hook to trigger on our save action, this hook is called create_category
. This function we create will handle the saving of our term information.
我们需要将一个函数附加到另一个挂钩上,以触发我们的保存操作,该挂钩称为create_category
。 我们创建的此功能将处理术语信息的保存。
When collecting information that will be directly used in updating the WordPress database, it’s always a good practice to sanitize values. We can use ‘sanitize_text_field($string)’ to sanitize a string, stripping all tags, removing line breaks, tabs and converts character entities such as
当收集将直接用于更新WordPress数据库的信息时,清理值始终是一个好习惯。 我们可以使用'sanitize_text_field($ string)'清理字符串,剥离所有标签,删除换行符,制表符并转换字符实体,例如
.
。
function save_extra_taxonomy_fields($term_id){
//collect all term related data for this new taxonomy
$term_item = get_term($term_id,'category');
$term_slug = $term_item->slug;
//collect our custom fields
$term_category_text = sanitize_text_field($_POST['category-text']);
$term_category_textarea = sanitize_text_field($_POST['category-textarea']);
$term_category_select = sanitize_text_field($_POST['category-select']);
$term_category_radio = sanitize_text_field($_POST['category-radio']);
//save our custom fields as wp-options
update_option('term_category_text_' . $term_slug, $term_category_text);
update_option('term_category_textarea_' . $term_slug, $term_category_textarea);
update_option('term_category_select_' . $term_slug, $term_category_select);
update_option('term_category_radio_' . $term_slug, $term_category_radio);
}
sanitize_text_field
will work perfectly for these values. However, additional functions for handling different data types can be seen here: http://codex.wordpress.org/Data_Validation. Thanks to Ryan Hellyer for his advice and comments.
sanitize_text_field
对于这些值将完美工作。 但是,可以在此处看到用于处理不同数据类型的其他功能: http : //codex.wordpress.org/Data_Validation 。 感谢Ryan Hellyer的建议和评论。
This function takes in one parameter, the ID of the new term being saved.
此函数采用一个参数,新术语的ID被保存。
With this ID we are able to call the get_term($term_id,$taxonomy_name)
function.
使用此ID,我们可以调用get_term($term_id,$taxonomy_name)
函数。
This function takes in two parameters, the ID of the term itself and the taxonomy name. Since we know the ID of the term itself and also that we are working on the category
taxonomy, we will now be able to access the term object.
此函数接受两个参数,术语本身的ID和分类名称。 由于我们知道术语本身的ID,而且我们正在研究category
分类法,因此我们现在可以访问术语对象。
We collect the slug
value from the term object and save it. Then we collect all four of our new fields values from the $_POST object. Finally we called another function called update_option($option_name,$option_value)
.
我们从术语对象收集slug
值并将其保存。 然后,我们从$ _POST对象收集所有四个新字段值。 最后,我们调用了另一个名为update_option($option_name,$option_value)
函数。
This function allow us to create a new entry in the WordPress options table so we can save our value. All this function needs is the name of the new option and its value. We are calling this function four times, one for each of our new fields we are saving.
此功能使我们可以在WordPress选项表中创建一个新条目,从而可以保存我们的价值。 所有这些功能所需的就是新选项的名称及其值。 我们将调用此函数四次,对于每个要保存的新字段,一次。
For example, if we are creating a new category called test
when we are saving our textarea field the option name will become term_category_textarea_test
and our select field option will become text_category_select_test
etc. We are adding our slug
onto the end of the name for these fields to ensure that no two values can be the same (as all slugs are unique).
例如,如果我们正在创造一个新的类别名为test
,当我们拯救我们的textarea领域的选项名称将成为term_category_textarea_test
和我们的选择字段选项将成为text_category_select_test
等。我们将我们的slug
到名称为这些领域的最终确保没有两个值可以相同(因为所有块都是唯一的)。
Now all we have to do is hook this function up to the create_category
hook and we are sorted
现在,我们要做的就是将此函数连接到create_category
钩子上,并进行排序
add_action('create_category','save_extra_taxonomy_fields');
修改编辑类别管理菜单 (Modifying the edit category administration menu)
Now that we have our new field elements displaying on the add category screen and have saved these as options, we need to modify the edit screen and pre-populate our new values here (so they can be updated if required).
现在,我们的新字段元素已显示在添加类别屏幕上,并将它们保存为选项,我们需要修改编辑屏幕并在此处预先填充新值(以便可以根据需要对其进行更新)。
We will need to attach onto the category_edit_form_fields
hook to display our additional fields.
我们将需要附加到category_edit_form_fields
钩子上以显示其他字段。
The category_edit_form_fields
hook is used to output additional fields to the edit administration screen for categories. This hook takes in one value, which is the term object itself. Since this hook will have access to the term object itself, it will be very simple to collect its information.
category_edit_form_fields
挂钩用于将其他字段输出到类别的编辑管理屏幕。 这个钩子接受一个值,这是术语对象本身。 由于此挂钩可以访问术语对象本身,因此收集其信息将非常简单。
We need to create a function that will output our additional fields and pre-populate them with our information. Since we now have access to the term object this will be easy.
我们需要创建一个函数,该函数将输出其他字段并用我们的信息预先填充它们。 由于我们现在可以访问术语对象,因此这很容易。
function edit_extra_fields_for_category($term){
//collect the term slug
$term_slug = $term->slug;
//collect our saved term field information
$term_category_text = get_option('term_category_text_' . $term_slug);
$term_category_textarea = get_option('term_category_textarea_' . $term_slug);
$term_category_select = get_option('term_category_select_' . $term_slug);
$term_category_radio = get_option('term_category_radio_' . $term_slug);
//output our additional fields?>
<tr class="form-field">
<th valign="top" scope="row">
<label for="category-text"> Category Text Field </label>
</th>
<td>
<input type="text" name="category-text" id="category-text" value="<?php echo $term_category_text; ?>"/>
<p class="description">This is a text field </p>
</td>
</tr>
<tr class="form-field">
<th valign="top" scope="row">
<label for="category-textarea"> Category Textarea Field </label>
</th>
<td>
<textarea name="category-textarea" id="category-textarea"><?php echo $term_category_textarea; ?></textarea>
<p class="description">This is a textarea field </p>
</td>
</tr>
<tr class="form-field">
<th valign="top" scope="row">
<label for="category-select"> Category Select Field </label>
</th>
<td>
<select name="category-select" id="category-select" value="<?php echo $term_category_select; ?>">
<option value="select-value-one" <?php if($term_category_select=='select-value-one'){ echo 'selected';}?>> Value One </option>
<option value="select-value-two" <?php if($term_category_select=='select-value-two'){ echo 'selected';}?>> Value Two </option>
</select>
<p class="description">This is a select field </p>
</td>
</tr>
<tr>
<th valign="top" scope="row">
<label> Category Radio Field </label>
</th>
<td>
<label for="category-radio-value-one">Category Radio Value One</label>
<input type="radio" name="category-radio" id="category-radio-value-one" value="category-radio-value-one" <?php if($term_category_radio=='category-radio-value-one'){ echo 'checked'; }?> />
<br/>
<label for="category-radio-value-two">Category Radio Value Two</label>
<input type="radio" name="category-radio" id="category-radio-value-two" value="category-radio-value-two" <?php if($term_category_radio=='category-radio-value-two'){ echo 'checked'; }?>/>
<p>This is a radio field </p>
</td>
</tr>
<?php
}
This function uses its passed in term
object to access the slug
of the term itself. Using this slug, it searched for our four saved custom field values using theget_option($option_name)
function.
该功能使用其传入term
对象访问的slug
这个词本身的。 使用此get_option($option_name)
,它使用get_option($option_name)
函数搜索了四个保存的自定义字段值。
This function searched for an option with the specified name and assigns its value. In our case we are looking for our four field values and will be assigning them to variables.
此函数搜索具有指定名称的选项并分配其值。 在本例中,我们正在寻找四个字段值,并将它们分配给变量。
The largest part of this function is outputting our HTML form elements, they are added as table elements. For each of our fields we display the label and the applicable text, textarea, select or radio elements.
此功能最大的部分是输出我们HTML表单元素,它们作为表元素添加。 对于我们的每个字段,我们都显示标签和适用的文本,textarea,select或radio元素。
The way that we pre-populate our custom fields is different for each type we are handling. Here is what we do
对于每种类型,我们预填充自定义字段的方式是不同的。 这是我们的工作
-
Text Field – For the textfield we assign its value directly to its
value
attribute, which will pre-populate the field itself文本字段–对于文本字段,我们将其值直接分配给其
value
属性,这将预先填充字段本身 -
Textarea field – For the textarea field we echo its value directly between the
<textarea>
and</textarea>
tags, this outputs its value directly into the textarea element.Textarea字段–对于textarea字段,我们直接在
<textarea>
和</textarea>
标记之间回显其值,这会将其值直接输出到textarea元素中。 -
Select Field – For the select field we first create the select element and all of its associated options. We add an attribute for the select element called
value
and populate it with our saved value (this is very similar to how we handled the text field). Even though we are outputting the value into the select list, we still need to determine which option will be initially selected. What we do now is for each of the options in the select element, we determine if its value is the same as what we collected, if it is it is selected. We use a basicIF
statement and if they match we echo theselected
attribute onto the option, this will make the browser select this option by default.选择字段–首先为选择字段创建选择元素及其所有关联选项。 我们为select元素添加了一个名为
value
的属性,并使用保存的值填充该属性(这与处理文本字段的方式非常相似)。 即使将值输出到选择列表中,我们仍然需要确定最初选择哪个选项。 现在,对于select元素中的每个选项,我们要做的是确定其值是否与我们收集的值相同(如果已选择)。 我们使用基本的IF
语句,如果它们匹配,我们会将selected
属性回显到选项上,这将使浏览器默认情况下选择此选项。 -
Radio Field – For the radio fields we output them directly onto the page and determine if their value matches the saved value, if so we use a basic
IF
statement to output thechecked
attribute onto it, this attribute makes the browser select this value by default (in many ways this is handled similar to a select element, as we need to tell the browser which option to have displayed)Radio Field –对于无线电字段,我们将它们直接输出到页面上,并确定它们的值是否与保存的值匹配,如果是的话,我们使用基本的
IF
语句在其上输出checked
属性,此属性使浏览器默认选择此值(在很多方面,这都类似于select元素,因为我们需要告诉浏览器显示了哪个选项)
Making sure these values are pre-populated correctly is critically important as if you don’t select them, when the user updates their term their data may not be consistent.
确保正确地预填充这些值至关重要,就好像您没有选择它们一样,当用户更新其术语时,其数据可能不一致。
All we have to do is connect our new function to the category_edit_form_fields
hook and this function will execute when we click on the edit
screen for our terms.
我们要做的就是将我们的新函数连接到category_edit_form_fields
钩子,当我们在术语的edit
屏幕上单击时,该函数将执行。
add_action('category_edit_form_fields','edit_extra_fields_for_category');
After hooking this function your category edit screen should be updated and show your additional fields and values. Mine looks as follows:
启用此功能后,您的类别编辑屏幕应会更新,并显示其他字段和值。 我的看起来如下:
保存我们更新的类别信息 (Saving our updated category information)
When we update our category information we will need a function to save our new field values.
当我们更新类别信息时,我们将需要一个函数来保存新的字段值。
Thankfully, we already have a function for that. Previously we created thesave_extra_taxonomy_fields($term_id)
function which we used when we added a new category term.
幸运的是,我们已经有了一个函数。 以前,我们创建了save_extra_taxonomy_fields($term_id)
函数,该函数在添加新类别术语时使用。
We can call this function when we update the category by attaching it onto another hook. We will add our save_extra_taxonomy_fields
function onto the edit_category
hook and when we update our category this function will save our information.
通过将类别附加到另一个钩子上来更新类别时,可以调用此函数。 我们将把save_extra_taxonomy_fields
函数添加到edit_category
钩子上,并且当我们更新类别时,该函数将保存我们的信息。
add_action('edit_category','save_extra_taxonomy_fields');
扩展自定义分类法 (Extending custom taxonomies)
Custom taxonomies can be extended in the exact same manor as the inbuilt taxonomies (categories and tags).
可以按照与内置分类法(类别和标签)完全相同的方式扩展自定义分类法。
The only modifications you will need to make will be to the names of the hooks used.
您需要进行的唯一修改将是所使用的挂钩的名称。
For categories you would use the following hooks:
对于类别,您将使用以下挂钩:
-
category_add_form_fields
– Add fields to your category new term screencategory_add_form_fields
–将字段添加到类别新术语屏幕 -
category_edit_form_fields
– Add fields to your category edit term screencategory_edit_form_fields
–将字段添加到类别编辑术语屏幕 -
create_category
– Used when you want to save your new category termcreate_category
–在您要保存新类别术语时使用 -
edit_category
– Used when you want to save your updated category termedit_category
–在您要保存更新的类别术语时使用
Those hooks would connect you to the areas you need to edit, allowing you to save and retrieve your additional information.
这些挂钩会将您连接到需要编辑的区域,从而可以保存和检索其他信息。
For custom taxonomies they would be very similar, the hooks you would use are dynamic and based on the name of your taxonomy, they would be:
对于自定义分类法,它们将非常相似,您将使用的钩子是动态的,并且基于分类法的名称,它们将是:
-
$TAXONOMY_NAME_add_form_fields
$TAXONOMY_NAME_add_form_fields
-
$TAXONOMY_NAME_edit_form_fields
$TAXONOMY_NAME_edit_form_fields
-
create_$TAXONOMY_NAME
,create_$TAXONOMY_NAME
, -
edit_$TAXONOMY_NAME
edit_$TAXONOMY_NAME
For example if you registered your own taxonomy called members
your hooks would be called:
例如,如果您注册了自己的称为members
的分类法,则您的钩子将被称为:
-
members_add_form_fields
members_add_form_fields
-
members_edit_form_fields
members_edit_form_fields
-
create_members
,create_members
, -
edit_members
edit_members
You need to follow the basic pattern and apply them to your custom taxonomy and you will be able to edit these screens and save your information as you need.
您需要遵循基本模式并将其应用于自定义分类法,然后您将能够编辑这些屏幕并根据需要保存信息。
包装全部 (Wrapping It All Up)
Now that you know how to save additional information for your taxonomies / terms, you can extend WordPress to do even more than what it was originally intended to do.
既然您知道了如何为分类法/术语保存其他信息,那么您可以扩展WordPress,使其工作范围超出其最初的意图。
You can access your individual term using get_term($term_name,$taxonomy_name)
and then from there you can use your slug as we have done to access additional information pulled from the WordPress options table.
您可以使用get_term($term_name,$taxonomy_name)
访问您的单个术语,然后从那里使用您的get_term($term_name,$taxonomy_name)
就像我们已经完成的那样,以访问从WordPress选项表中提取的其他信息。
You can edit your child theme files and other resources to take advantage of this new information. I would start by editing your category.php or tag.php file if you have altered those taxonomies to pull in your new information.
您可以编辑子主题文件和其他资源以利用此新信息。 如果您已经更改了这些分类法以获取新信息,那么我将首先编辑您的category.php或tag.php文件。
There is virtually no limit as to the complexity you can accomplish with your taxonomies now as you can save any information you like and output it as required.
现在,您可以使用分类法完成的复杂性几乎没有限制,因为您可以保存所需的任何信息并根据需要将其输出。
If you’re interested in more information on custom taxonomies, check out “A refresher on custom taxonomies” by Justin Tadlock.
如果您对自定义分类法的更多信息感兴趣,请查看Justin Tadlock的“自定义分类法的复习” 。
翻译自: https://www.sitepoint.com/extending-wordpress-taxonomies/
wordpress分类
上一篇: 课程Spring注解驱动学习笔记(十三)servlet组件注册
下一篇: this is incompatible with sql_mode=only_full_group_by 博客分类: mysql
推荐阅读
-
wordpress分类_扩展WordPress分类法
-
WordPress4分页 博客分类: PHP phppaginationwordpress分页
-
博客系统wordpress 博客分类: INFO wordpress博客
-
iPhone3GS restart loop after reset network settings 博客分类: iPhone WordPress
-
iPhone3GS restart loop after reset network settings 博客分类: iPhone WordPress
-
wordpress如何显示指定分类一周内最新文章数量
-
十大WordPress的SEO优化技巧 博客分类: SEO
-
请恕小弟我愚钝,xmlrpc.inc远程获取和添加wordpress分类
-
请教个关于wordpress的自己的分类加载页面的问题
-
请教个关于wordpress的自己的分类加载页面的问题