Making WordPress.org


Ignore:
Timestamp:
03/08/2022 07:03:14 PM (4 years ago)
Author:
coreymckrill
Message:

Learn: Sync with git WordPress/learn@1e97bc74e65df8b03e28035e064f4b0deb0cd93b

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/template-parts/component-breadcrumbs.php

    r10513 r11651  
    1515);
    1616
    17 // Get information about the post title.
    18 $cpt_object = get_post_type_object( get_post_type( get_queried_object() ) );
     17if ( is_post_type_archive() ) {
     18    array_push( $crumbs, array(
     19        'label' => post_type_archive_title( '', false ),
     20        'url' => '',
     21    ));
     22} elseif ( is_singular() ) {
     23    if ( is_single() ) {
     24        $cpt_object = get_post_type_object( get_post_type() );
    1925
    20 if ( 'lesson-plan' === get_post_type() ) {
     26        array_push($crumbs, array(
     27            'label' => $cpt_object->label,
     28            'url'   => home_url( $cpt_object->has_archive ),
     29        ));
     30    }
    2131    array_push( $crumbs, array(
    22         'label' => ucfirst( $cpt_object->labels->name ),
    23         'url'   => home_url( $cpt_object->has_archive ),
     32        'label' => get_the_title(),
     33        'url'   => '',
    2434    ) );
     35} elseif ( is_search() ) {
     36    array_push( $crumbs, array(
     37        'label' => get_search_query(),
     38        'url' => '',
     39    ));
    2540}
    26 
    27 array_push( $crumbs, array(
    28     'label' => get_the_title(),
    29     'url'   => '',
    30 ) );
    3141?>
    3242
Note: See TracChangeset for help on using the changeset viewer.