CO Test Plugin
Simple display mechanism plugin for CO
by Claude, Thirty8 Digital · github.com/dmje/aerotheque-culture-object-test
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/dmje/aerotheque-culture-object-test/archive/refs/heads/main.zipTakes over how the Culture Object plugin's "object" custom post type is displayed on the front end — both the single object page and the object archive/listing page — without needing any theme template files.
How it works
Normally a theme controls how a post type looks via its own template files. This plugin skips that entirely: it hooks into the_content and the_excerpt and, whenever the current post is an object, swaps in its own HTML instead of the theme's usual output. Because it works through these filters, it fits into whatever template the active theme already uses for single posts and archives.
- Single object page → renders
templates/single.php, showing the object's title, permalink, and its custom fields (e.g. maker, ID) as a list. - Object archive/listing page → renders
templates/archive.phpfor each object, showing a simple "ID" link through to the object's own page.
The archive view is hooked on both the_content and the_excerpt because different themes call one or the other when building their listing loop — hooking both means the archive card shows up correctly no matter which the theme uses.
Editing the output
You don't need to be a developer to change what's displayed:
- Open
templates/single.phportemplates/archive.php. - Each file starts with a comment listing the variables available to use (e.g.
$title,$permalink,$meta). - Edit the HTML/PHP around those variables as needed — it's just an HTML fragment.
If you need a new piece of data added (a field that isn't currently passed through), ask a developer to add it in co-test-plugin.php — the comment in each template tells you which function to look for.
Files
| File | Purpose |
|---|---|
co-test-plugin.php |
Plugin bootstrap and logic: hooks into the_content/the_excerpt, gathers the data for each view, and loads the matching template. |
templates/single.php |
Output for a single object's page. |
templates/archive.php |
Output for one object's entry on the archive/listing page. |
Requirements
- WordPress with the Culture Object plugin active (this plugin only acts on its
objectpost type). - PHP 7.4+.