From 935dd741945e9a4a553b9346df3233e356cc9a52 Mon Sep 17 00:00:00 2001 From: Keith Solomon Date: Fri, 28 Aug 2026 20:06:54 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8feature:=20Implement=20project-type=20?= =?UTF-8?q?taxonomy=20archive=20template=20and=20enhance=20breadcrumb=20na?= =?UTF-8?q?vigation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archive-project-type.php | 53 ++++++++++++++++++ lib/class-breadcrumbs.php | 24 ++++++++- lib/extras.php | 42 +++++++++++++++ styles/components/project-card.css | 32 +++++++++-- styles/navigation/nav-main-default.css | 75 ++++++++++++-------------- taxonomy-project-type.php | 57 -------------------- 6 files changed, 178 insertions(+), 105 deletions(-) create mode 100644 archive-project-type.php delete mode 100644 taxonomy-project-type.php diff --git a/archive-project-type.php b/archive-project-type.php new file mode 100644 index 0000000..2a4c295 --- /dev/null +++ b/archive-project-type.php @@ -0,0 +1,53 @@ +name : __( 'Projects', 'ks-portfolio' ); +?> +
+ +
+ +
+ +
+ 2, + 'prev_text' => '« ' . esc_html__( 'Previous', 'ks-portfolio' ), + 'next_text' => esc_html__( 'Next', 'ks-portfolio' ) . ' »', + ) + ); + ?> +
+ +
+

+

+
+ +
+ + $postType->labels->name ) : array(); } + /** Generates a clickable Projects archive breadcrumb. + * + * Used in the taxonomy archive trail so users have a working "back to + * all projects" link in the breadcrumb. Distinct from + * getPostTypeArchiveBreadcrumb(), which omits the URL because on the + * post-type archive itself that crumb is the active leaf and shouldn't + * link to itself. + * + * @return array Breadcrumb data with both label and url. + */ + private static function getProjectsArchiveLinkBreadcrumb() { + $url = get_post_type_archive_link( 'projects' ); + return array( + 'url' => $url ? $url : '', + 'label' => __( 'Projects', 'ks-portfolio' ), + ); + } + /** Generates breadcrumbs for date-based archives. * * This method is responsible for creating breadcrumb navigation diff --git a/lib/extras.php b/lib/extras.php index 041e8c7..5a941a7 100644 --- a/lib/extras.php +++ b/lib/extras.php @@ -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

, 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 "