✨feature: Implement project-type taxonomy archive template and enhance breadcrumb navigation
Sync TODOs with Issues / sync_todos (push) Successful in 8s
Sync TODOs with Issues / sync_todos (push) Successful in 8s
This commit is contained in:
@@ -46,7 +46,11 @@ class Breadcrumbs {
|
||||
// Static Page - add the parent pages if any, and the page title
|
||||
$breadcrumbs = array_merge( $breadcrumbs, self::getStaticPageBreadcrumbs( $post ) );
|
||||
} elseif ( is_category() || is_tag() || is_tax() ) {
|
||||
// Taxonomy Archive - add the taxonomy term name
|
||||
// Taxonomy Archive - if this is a project-type term, surface the
|
||||
// Projects archive as a clickable parent in the trail.
|
||||
if ( is_tax( 'project-type' ) ) {
|
||||
$breadcrumbs[] = self::getProjectsArchiveLinkBreadcrumb();
|
||||
}
|
||||
$breadcrumbs[] = self::getTaxonomyArchiveBreadcrumb();
|
||||
} elseif ( is_post_type_archive() ) {
|
||||
// Post Type Archive - add the post type name
|
||||
@@ -205,6 +209,24 @@ class Breadcrumbs {
|
||||
return $postType ? array( 'label' => $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
|
||||
|
||||
Reference in New Issue
Block a user