Skip to main content

WPW Authority Contents Sidebars

Overview

Version 0.2.1 by wpwhite.com. Creates a hierarchical authority content taxonomy (wpst_authority_topic) and renders a frontend sidebar panel on single posts showing the reader's position in the authority structure.

Architecture

Custom Taxonomy (wpst_authority_topic)
→ Top Level (Domain): "Linux", "DevOps", "CLI"
→ Topic: "Server Setup", "Docker", "Bash Scripting"
→ Sub Topic: "Ubuntu", "Docker Compose", "String Manipulation"
→ Posts assigned to any level

Taxonomy Rules

RuleDetail
Max depth3 levels (Top → Topic → Sub Topic)
Auto-flatteningTerms deeper than Sub Topic are reattached one level higher
Non-publicOnly accessible via admin screens
HierarchicalYes (hierarchical => true)

Admin Interface

1. Post Editor Metabox (Side)

Every post gets a "Authority Sidebar" metabox with:

  • Structure Placement: Hierarchical dropdown of authority terms
  • Resolved Path: Read-only breadcrumb showing the term's full path
  • Manual Order: Numeric fallback ordering
  • Editorial Notes: Internal notes (not shown on frontend)
  • Frontend Icon Preview: Shows whether the icon will display

2. Authority Sidebar Order Screen

A dedicated admin screen under Posts > Authority Sidebars with:

  • Filter by top-level topic
  • Drag-and-drop sorting of posts within each branch
  • Statistics (top levels, topics, subtopics, posts)
  • Save/Load filter presets

Branch order is stored as a site option (wpst_authority_sidebar_order) in the format:

['term_123' => [45, 62, 13, ...], 'term_456' => [...]]

3. Admin Notices

  • Depth violation warning shown on taxonomy screen
  • Help text on term add/edit forms explaining hierarchy rules

Frontend Rendering

A toggle button appears in the GeneratePress menu bar (via generate_menu_bar_items hook at priority 61) on single posts with an assigned authority term.

Icon: SVG document icon with nested structure lines.

When activated, a slide-out panel renders:

  • Top-level branch name with "Authority Structure" label
  • Hierarchical tree with collapsible topic/subtopic sections
  • Current post highlighted with .is-current class
  • Current branch expanded with .is-current-branch class
  • "Keep open" toggle (persisted via localStorage)
  • Close button and backdrop click-to-close

Post Ordering Priority

  1. Drag-and-drop order from the admin ordering screen
  2. Manual order (numeric _wpst_authority_order post meta)
  3. Alphabetical by title (fallback)

Conditional Loading

Frontend assets only load when:

  • Not admin
  • Is a single post (is_singular('post'))
  • Post status is publish
  • Post has an assigned authority term