定制 keyagency/taxonomy-terms-order 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

keyagency/taxonomy-terms-order

Composer 安装命令:

composer require keyagency/taxonomy-terms-order

包简介

Drag & drop reordering for Statamic taxonomy terms

README 文档

README

Drag & drop reordering for taxonomy terms in the Statamic Control Panel.

Statamic supports reordering entries in collections, but taxonomy terms are always sorted alphabetically. This addon adds a dedicated Terms Order page per taxonomy where you can drag terms into the desired order. After saving, the Control Panel terms listing follows that order automatically — and your frontend templates can too.

Features

  • Drag & drop reordering of taxonomy terms, straight from the CP navigation
  • Order is stored as a plain order field in each term's YAML — no database, no magic
  • Sets sort_by: order on the taxonomy, so the native CP terms listing follows the manual order automatically
  • New terms are appended to the end of the list automatically
  • Reset button to remove the manual order and go back to alphabetical sorting
  • Dedicated reorder {taxonomy} terms permission per taxonomy
  • Multisite-ready: order is shared across sites, titles stay localized
  • Zero core overrides: built entirely on Statamic's public addon APIs

How to Install

Run the following command from your project root:

composer require keyagency/taxonomy-terms-order

How to Use

  1. Open the Control Panel. A Terms Order item appears in the Tools section of the navigation. It links to an overview of all orderable taxonomies (there's also a child link per taxonomy).
  2. Pick a taxonomy, drag the terms into the desired order and hit Save Order (or cmd+s).
  3. Done. The terms listing and your frontend now follow the manual order.

Changed your mind? Hit Reset on the taxonomy's order page to remove the manual order from all terms and go back to alphabetical sorting.

Limiting which taxonomies are orderable

By default every taxonomy can be reordered. To limit this, publish the config:

php artisan vendor:publish --tag=taxonomy-terms-order-config
// config/statamic/taxonomy-terms-order.php

return [
    'taxonomies' => ['article_categories'], // or ['*'] for all
];

Permissions

Non-super users need the Reorder terms permission, which appears per taxonomy in the "Taxonomy Terms Order" permissions group. Users without this permission won't see the navigation item.

Frontend

The {{ taxonomy:* }} tag does not apply a default sort, so add the order_by parameter in your templates:

{{ taxonomy:article_categories order_by="order:asc|title:asc" }}
    {{ title }}
{{ /taxonomy:article_categories }}

The title:asc fallback keeps taxonomies without a manual order sorted alphabetically, so the same partial works for both.

How it works

  • Saving an order writes a sequential order key into each term's YAML file (content/taxonomies/<taxonomy>/<slug>.yaml).
  • The taxonomy config gets sort_by: order and sort_dir: asc, which Statamic natively supports for sorting the CP terms listing.
  • A TermSaving listener assigns max(order) + 1 to terms created without an order, so they land at the bottom of the list.

Support

Found a bug or have a feature request? Open an issue or email development@keyagency.nl.

About Key Agency

Key Agency is a digital agency based in Amsterdam that helps brands grow with strategy, content, technology and advertising working together as one digital ecosystem.

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固