generated from pascalmartineau/wp-skeleton
fix: Breadcrumbs
All checks were successful
Deploy WordPress and Nuxt / deploy (push) Successful in 59s
All checks were successful
Deploy WordPress and Nuxt / deploy (push) Successful in 59s
This commit is contained in:
@@ -50,7 +50,7 @@ function ccat_get_breadcrumbs( $node ) {
|
||||
if ( $post ) {
|
||||
$breadcrumbs = ccat_get_post_breadcrumbs( $post );
|
||||
$breadcrumbs[] = array(
|
||||
'label' => get_the_title( $post->ID ),
|
||||
'label' => html_entity_decode( get_the_title( $post->ID ), ENT_QUOTES, 'UTF-8' ),
|
||||
'uri' => null,
|
||||
);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ function ccat_get_breadcrumbs( $node ) {
|
||||
if ( $term && ! is_wp_error( $term ) ) {
|
||||
$breadcrumbs = ccat_get_term_breadcrumbs( $term );
|
||||
$breadcrumbs[] = array(
|
||||
'label' => $term->name,
|
||||
'label' => html_entity_decode( $term->name, ENT_QUOTES, 'UTF-8' ),
|
||||
'uri' => null,
|
||||
);
|
||||
}
|
||||
@@ -69,8 +69,17 @@ function ccat_get_breadcrumbs( $node ) {
|
||||
|
||||
// Helper: Get breadcrumbs for a given post
|
||||
function ccat_get_post_breadcrumbs( $post ) {
|
||||
$breadcrumbs = array();
|
||||
$post_type = get_post_type( $post->ID );
|
||||
$breadcrumbs = array();
|
||||
$is_front_page = get_option( 'show_on_front' ) === 'page' && get_option( 'page_on_front' ) == $post->ID;
|
||||
if ( $is_front_page ) {
|
||||
return $breadcrumbs; // No breadcrumbs for the front page
|
||||
} else {
|
||||
$breadcrumbs[] = array(
|
||||
'label' => 'Accueil',
|
||||
'uri' => '/',
|
||||
);
|
||||
}
|
||||
$post_type = get_post_type( $post->ID );
|
||||
switch ( $post_type ) {
|
||||
case 'page':
|
||||
$ancestors = get_post_ancestors( $post->ID );
|
||||
|
||||
Reference in New Issue
Block a user