+
+
+
+ $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 "