fix: root template requires at __DIR__ and drop an unused template part - #139
Merged
Merged
Conversation
The two taxonomy templates that compose from parts/ used bare relative requires, which resolved only via PHP's fallback to the calling file's directory. Rooting them at __DIR__ removes the reliance on that implicit lookup. Behavior is unchanged. Also removes lib/templates/parts/post-query.php. Nothing required it, and it queries postType "post" rather than "fund", so it could not have served these templates anyway. It shipped in the ZIP regardless, since lib/ is in the files array. Records the template composition split in ROADMAP section 4 as an open question: taxonomy-fund-type and taxonomy-fund-theme are 11 lines built from parts, while archive-fund, single-fund, taxonomy-area and taxonomy-keyword inline everything, and the two inlined taxonomy templates are near-identical to each other. Closes #134 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #134.
Changes
1.
__DIR__-rooted requires —lib/templates/taxonomy-fund-type.phpandtaxonomy-fund-theme.php:To be precise about what this fixes: the old form worked — PHP falls back to the calling file's directory when a relative include isn't found on the include path. This removes the reliance on that implicit lookup rather than repairing a break. Behavior is unchanged.
2. Deleted
lib/templates/parts/post-query.php. Nothing referenced it — verified repo-wide, the only mention was a line incopilot-instructions.mdlisting it. It also queries"postType":"post", notfund, so it's a generic blog loop that could never have served these templates. It shipped in the ZIP regardless, sincelib/is in thefilesarray.3. Docs —
CLAUDE.mdandcopilot-instructions.mdboth described the requires as relative; both now describe the current state.ROADMAP note on the template split
Recorded in §4 as an open question rather than acted on, since you wanted to look at the templates first:
taxonomy-fund-type.phpparts/taxonomy-fund-theme.phpparts/taxonomy-area.phptaxonomy-keyword.phparchive-fund.phpsingle-fund.phpThe two inlined taxonomy templates are near-identical to each other, so a change to the archive layout has to be made in both, and neither picks up edits to
parts/.The note also flags that the three questions are entangled — the inlined templates are also the ones carrying the hardcoded media (#133) and the unpinned template-part references (#136), so they're best looked at together.
Verification
composer lintclean, PHPUnit green (24 tests) — but neither covers template rendering, which is what this change actually touches. So I rendered all six templates throughucscgiving_get_template_content()from a different working directory (/), which is the case the implicit fallback was covering:The two parts-based templates expand from 842 bytes to 3486, so the parts are being pulled in, and both carry the
wp:searchandwp:querymarkup that only exists in those parts. The four inlined templates render byte-identical to source, as expected. No warnings or fatals.Still worth a manual look before merge: Fund Type and Fund Theme taxonomy archives in a browser. The unit suite does not cover template output (ROADMAP §3).
🤖 Generated with Claude Code