WP Tag Order plugin will order tags, non-hierarchical custom-taxonomy terms in individual posts with simple Drag and Drop Sortable capability. And supplies some functions to output it.
- WordPress 4.7+
cd /path-to-your/wp-content/plugins/
git clone [email protected]:sectsect/wp-tag-order.git
- Activate the plugin through the 'Plugins' menu in WordPress.
That's it 👌
- Supports
post_tag
andnon-hierarchical taxonomy
. - Supports multiple
non-hierarchical taxonomies
in a post-type. - In the case of creating a new post, you need to save the post once to activate this feature.
- To apply for the existing post, "
Add and Remove
" once something one tag.
Or, if you want to batch apply, Go toSettings
->WP Tag Order
page, and click theApply
button. - Supports Multisite.
- Tested on WP v4.7.4
Function | Description |
---|---|
get_the_tags_ordered() |
Based on get_the_tags() - Codex |
get_the_terms_ordered() |
Based on get_the_terms() - Codex |
get_the_tag_list_ordered() |
Based on get_the_tag_list() - Codex |
get_the_term_list_ordered() |
Based on get_the_term_list() - Codex |
the_tags_ordered() |
Based on the_tags() - Codex |
the_terms_ordered() |
Based on the_terms() - Codex |
<h2>get_the_tags_ordered()</h2>
<?php
$posttags = get_the_tags_ordered();
if ($posttags && ! is_wp_error($posttags)) {
foreach ($posttags as $tag) {
echo $tag->name . ' ';
}
}
?>
<h2>get_the_terms_ordered()</h2>
<?php
$posttags = get_the_terms_ordered($post->ID, 'post_tag');
if ($posttags && ! is_wp_error($posttags)) {
foreach ($posttags as $tag) {
echo $tag->name . ' ';
}
}
?>
<h2>get_the_tag_list_ordered()</h2>
<?php echo get_the_tag_list_ordered(); ?>
<h2>get_the_term_list_ordered()</h2>
<?php echo get_the_term_list_ordered($post->ID, 'post_tag'); ?>
<h2>the_tags_ordered()</h2>
<?php the_tags_ordered(); ?>
<h2>the_terms_ordered()</h2>
<?php the_terms_ordered($post->ID, 'post_tag'); ?>
-
The sorted tags will be saved in
wp_postmeta
table with an array of tag id that has been serialized as custom field.meta_id post_id meta_key meta_value 19 7 wp-tag-order-post_tag s:91:"a:7:{i:0;s:1:"7";i:1;s:1:"5";i:2;s:2:"10";i:3;s:1:"4";i:4;s:1:"6";i:5;s:1:"8";i:6;s:1:"9";}";
-
This Plugin does not hosting on the wordpress.org repo in order to prevent a flood of support requests from wide audience.
- 1.0.1 - Specification change for Wordpress 4.7
- 1.0.0 - Initial Release
See LICENSE file.