Skip to content

Commit

Permalink
Fix the breadcrumbs.
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenDufresne committed Dec 21, 2023
1 parent 0e731ca commit 81112a1
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion source/wp-content/themes/wporg-main-2022/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,30 @@ function override_lazy_loading( $value, $image ) {
* Use the page heirarchy to display breadcrumbs.
*/
function update_site_breadcrumbs( $breadcrumbs ) {

// Handle breadcrumbs for the data liberation section.
if ( is_post_type_archive( 'and-handbook') || is_singular( 'and-handbook' ) ) {
$breadcrumbs = array(
array(
'url' => home_url( '/data-liberation' ),
'title' => __( 'Home', 'wporg' ),
),
array(
'url' => home_url( '/data-liberation/and' ),
'title' => __( 'Guides', 'wporg' ),
),
);

if ( is_singular( 'and-handbook' ) ) {
$breadcrumbs[] = array(
'url' => false,
'title' => get_the_title(),
);
}

return $breadcrumbs;
}

$parent = get_post_parent();
if ( ! $parent ) {
return $breadcrumbs;
Expand Down Expand Up @@ -252,7 +276,7 @@ function add_site_navigation_menus( $menus ) {
function use_parent_page_title( $block_content, $block, $instance ) {

// Handle the site title for data liberation.
if ( is_post_type_archive( 'and-handbook') || is_singular( 'and-handbook' ) ) {
if ( is_post_type_archive( 'and-handbook') || is_singular( 'and-handbook' ) ) {
return str_replace(
array( home_url(), get_bloginfo( 'name' ) ),
array( home_url( '/data-liberation' ), __( 'Data Liberation', 'wporg' ) ),
Expand Down

0 comments on commit 81112a1

Please sign in to comment.