From 7e5ee2b3cdec6da5f3e93d9afd576fd0f3682576 Mon Sep 17 00:00:00 2001 From: Jason Chafin <1000543+Herm71@users.noreply.github.com> Date: Fri, 24 Apr 2026 10:11:24 -0700 Subject: [PATCH 1/6] add `CLAUDE.md` #2 --- CLAUDE.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..64ac8db --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,50 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Commands + +### PHP +```bash +composer run lint # PHP CodeSniffer (WordPress-Extra + WordPress-Docs standards) +composer run lint-fix # Auto-fix PHPCS violations +``` + +### Release & Packaging +```bash +npm run dryrun # Preview version bump without committing +npm run release # Bump version via standard-version (updates plugin.php header + CHANGELOG.md) +npm run zip # Package plugin as .zip for distribution +``` + +`npm run release` uses `wp-plugin-version-updater.js` to keep the version string in the `plugin.php` header in sync alongside the standard `package.json` bump. + +## Architecture + +This is a single-purpose WordPress plugin that provides an **A-Z Editorial Style Guide** CPT backed by ACF Pro. + +### Core dependency +**Advanced Custom Fields Pro** must be active. The plugin does not function without it. + +### Custom Post Type +`a_z_style_guide` ("Editorial Style Guide") — publicly queryable, searchable, non-hierarchical. Registered in `plugin.php`. + +### ACF JSON +Field group definitions live in `acf-json/`. The plugin filters `acf/settings/save_json` and `acf/settings/load_json` so ACF reads/writes field definitions from this directory rather than the database — keeping them version-controlled. + +- `group_5a1f2f21b2d3c.json` — field group with a `style_definitions` repeater (sub-fields: `editorial_style_item` text + `editorial_style_definition` WYSIWYG) +- `post_type_685d7e97c87c6.json` — ACF-managed CPT definition + +### Shortcodes (`lib/functions/shortcodes.php`) +- `[style-definition]` — renders the `style_definitions` repeater for the current post +- `[style-archive]` — queries all `a_z_style_guide` posts and renders their definitions + +### Admin settings page (`lib/functions/settings.php`) +Simple informational page under **Settings** showing plugin version (linked to GitHub releases) and feature list. Requires `manage_options` capability. + +### Namespace / autoloading +`composer.json` defines PSR-4 autoloading: `UCSC\UcscCommunicationsFunctionality\` → `src/`. No `src/` directory exists yet; this is placeholder infrastructure. Current code uses procedural `require_once` includes. + +## Known quirks + +- No unit tests, no PHPStan config, no JS build pipeline (no blocks or interactive JS). From 9d02fa2020f33e00f0eb7d591265b1261a895314 Mon Sep 17 00:00:00 2001 From: Jason Chafin <1000543+Herm71@users.noreply.github.com> Date: Fri, 24 Apr 2026 10:12:25 -0700 Subject: [PATCH 2/6] Fix namespace mismatch. Was `ucscgiving`, now `ucsccomms` #2 --- .phpcs.xml.dist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index ad21ed2..23e812f 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -75,7 +75,7 @@ - + @@ -84,7 +84,7 @@ - + From 868ed99ee90413a4521fb5aaf0d162a1a8d42b3f Mon Sep 17 00:00:00 2001 From: Jason Chafin <1000543+Herm71@users.noreply.github.com> Date: Fri, 24 Apr 2026 10:29:53 -0700 Subject: [PATCH 3/6] Enhance settings page output with proper escaping and improved feature descriptions #2 --- lib/functions/settings.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/functions/settings.php b/lib/functions/settings.php index 64847a0..b0520db 100644 --- a/lib/functions/settings.php +++ b/lib/functions/settings.php @@ -35,20 +35,18 @@ function ucsccomms_render_plugin_settings_page() { $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/ucsc-communications-functionality/plugin.php'); ?>
-

-

Version: (release notes)

-

+

+

Version: (release notes)

+


-

Features added by this plugin:

+

Features added by this plugin

+

Shortcodes

+

ACF JSON

+

Field group definitions are saved to and loaded from the plugin's acf-json folder, keeping them version-controlled rather than stored in the database.

Date: Fri, 24 Apr 2026 10:43:35 -0700 Subject: [PATCH 4/6] Update lib/functions/settings.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- lib/functions/settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions/settings.php b/lib/functions/settings.php index b0520db..c450cff 100644 --- a/lib/functions/settings.php +++ b/lib/functions/settings.php @@ -46,7 +46,7 @@ function ucsccomms_render_plugin_settings_page() {
  • [style-archive] — Displays a loop of all Editorial Style Guide posts on an archive page.
  • ACF JSON

    -

    Field group definitions are saved to and loaded from the plugin's acf-json folder, keeping them version-controlled rather than stored in the database.

    +

    Field group definitions are saved to and loaded from the plugin's acf-json folder, which supports version control and syncing alongside ACF's database storage.

    Date: Fri, 24 Apr 2026 17:47:12 +0000 Subject: [PATCH 5/6] fix: use UCSCCOMMS_PLUGIN_DIR constant, wrap strings in i18n functions, reword ACF JSON description Agent-Logs-Url: https://github.com/ucsc/ucsc-communications-functionality/sessions/40dff330-66f8-4729-a616-e9f59c4df644 Co-authored-by: Herm71 <1000543+Herm71@users.noreply.github.com> --- lib/functions/settings.php | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/lib/functions/settings.php b/lib/functions/settings.php index c450cff..4e52756 100644 --- a/lib/functions/settings.php +++ b/lib/functions/settings.php @@ -32,21 +32,34 @@ function ucsccomms_add_settings_page() { if ( ! function_exists( 'ucsccomms_render_plugin_settings_page' ) ) { function ucsccomms_render_plugin_settings_page() { - $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/ucsc-communications-functionality/plugin.php'); + $plugin_file = UCSCCOMMS_PLUGIN_DIR . 'plugin.php'; + $plugin_data = file_exists( $plugin_file ) ? get_plugin_data( $plugin_file ) : array(); + $plugin_name = ! empty( $plugin_data['Name'] ) ? $plugin_data['Name'] : ''; + $plugin_version = ! empty( $plugin_data['Version'] ) ? $plugin_data['Version'] : ''; + $plugin_desc = ! empty( $plugin_data['Description'] ) ? $plugin_data['Description'] : ''; ?>
    -

    -

    Version: (release notes)

    -

    +

    +

    +


    -

    Features added by this plugin

    -

    Shortcodes

    +

    +

    -

    ACF JSON

    -

    Field group definitions are saved to and loaded from the plugin's acf-json folder, which supports version control and syncing alongside ACF's database storage.

    +

    +

    array() ) + ), + 'acf-json' + ); + ?>

    Date: Fri, 24 Apr 2026 17:49:33 +0000 Subject: [PATCH 6/6] fix: escape URL with esc_url(), apply wp_kses() after sprintf() for ACF JSON description Agent-Logs-Url: https://github.com/ucsc/ucsc-communications-functionality/sessions/40dff330-66f8-4729-a616-e9f59c4df644 Co-authored-by: Herm71 <1000543+Herm71@users.noreply.github.com> --- lib/functions/settings.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/functions/settings.php b/lib/functions/settings.php index 4e52756..1cf42a0 100644 --- a/lib/functions/settings.php +++ b/lib/functions/settings.php @@ -40,7 +40,7 @@ function ucsccomms_render_plugin_settings_page() { ?>

    -

    +


    @@ -51,13 +51,13 @@ function ucsccomms_render_plugin_settings_page() {

    array() ) + 'acf-json' ), - 'acf-json' + array( 'code' => array() ) ); ?>