feature: Implement project-type taxonomy archive template and enhance breadcrumb navigation
Sync TODOs with Issues / sync_todos (push) Successful in 8s

This commit is contained in:
Keith Solomon
2026-08-28 20:06:54 -05:00
parent e31ed29962
commit 935dd74194
6 changed files with 178 additions and 105 deletions
+42
View File
@@ -154,6 +154,8 @@ function getTheTitle() {
if ( is_home() || is_single() ) {
$title = get_the_title( get_option( 'page_for_posts', true ) );
} elseif ( is_archive() ) {
// get_the_archive_title() is filtered below to drop the
// "Project Type:" / "Category:" prefix — see stripArchiveTitlePrefix().
$title = get_the_archive_title();
} elseif ( is_search() ) {
$title = sprintf(
@@ -170,6 +172,26 @@ function getTheTitle() {
return $title;
}
/** Strip the "Project Type:" / "Category:" / "Tag:" prefix from archive titles.
*
* WordPress's get_the_archive_title() returns plain text with the taxonomy
* or post-type label concatenated before a colon (e.g. "Project Type: Plugins",
* "Category: WordPress", "Tag: php"). The site's hero partial uses the raw
* archive title as its <h1>, and templates render their own context-appropriate
* headers, so the prefix is redundant and visually noisy.
*
* @param string $title The full archive title, including prefix.
* @return string The title with the prefix removed.
*/
function stripArchiveTitlePrefix( $title ) {
// Drop the "<Label>: " prefix WordPress prepends. The label may be wrapped
// in a <span> on some archive types (date archives) — strip that too.
$title = (string) $title;
$title = preg_replace( '/^\s*(?:<[^>]+>\s*)*[^:<]+:\s*/u', '', $title );
return $title;
}
add_filter( 'get_the_archive_title', __NAMESPACE__ . '\\stripArchiveTitlePrefix' );
/** Wraps iframes and embed elements in a div with a specific class.
*
* This function searches for iframe and embed elements within the provided
@@ -198,6 +220,26 @@ function divWrapper( $content ) {
add_filter( 'the_content', __NAMESPACE__ . '\\divWrapper' );
/** Strip the "<Label>: " prefix from the document title.
*
* The SEO Framework wipes out all `pre_get_document_title` filters at
* `template_redirect` priority 20 and composes the title itself. To strip
* the archive prefix consistently across <title>, og:title, and twitter:title
* (which all derive from TSF's generated archive title list), hook the
* archive-title-items filter and return the unprefixed title.
*
* @param array $items [title, prefix, title_without_prefix]
* @return array The same items with the prefix removed from the title.
*/
function stripArchiveTitleItemsPrefix( $items ) {
if ( ! is_array( $items ) || empty( $items[2] ) ) {
return $items;
}
$items[0] = $items[2];
return $items;
}
add_filter( 'the_seo_framework_generated_archive_title_items', __NAMESPACE__ . '\\stripArchiveTitleItemsPrefix' );
/** Selectively add sidebar to page.
*
* This function adds a custom field group to the WordPress editor for