WordPress.org

Make WordPress Core

Ticket #40969: 40969.3.diff

File 40969.3.diff, 2.0 KB (added by tferry, 10 months ago)

Updates multiple get_*() template part functions to return the value of locate_template

  • src/wp-includes/general-template.php

     
    1616 * "special".
    1717 *
    1818 * @since 1.5.0
     19 * @since x.y.z Added the return value.
    1920 *
    2021 * @param string $name The name of the specialised header.
     22 * @return string The template filename if one is located.
    2123 */
    2224function get_header( $name = null ) {
    2325        /**
     
    3840
    3941        $templates[] = 'header.php';
    4042
    41         locate_template( $templates, true );
     43        return locate_template( $templates, true );
    4244}
    4345
    4446/**
     
    5153 * "special".
    5254 *
    5355 * @since 1.5.0
     56 * @since x.y.z Added the return value.
    5457 *
    5558 * @param string $name The name of the specialised footer.
     59 * @return string The template filename if one is located.
    5660 */
    5761function get_footer( $name = null ) {
    5862        /**
     
    7377
    7478        $templates[] = 'footer.php';
    7579
    76         locate_template( $templates, true );
     80        return locate_template( $templates, true );
    7781}
    7882
    7983/**
     
    8690 * "special".
    8791 *
    8892 * @since 1.5.0
     93 * @since x.y.z Added the return value.
    8994 *
    9095 * @param string $name The name of the specialised sidebar.
     96 * @return string The template filename if one is located.
    9197 */
    9298function get_sidebar( $name = null ) {
    9399        /**
     
    108114
    109115        $templates[] = 'sidebar.php';
    110116
    111         locate_template( $templates, true );
     117        return locate_template( $templates, true );
    112118}
    113119
    114120/**
     
    128134 * "special".
    129135 *
    130136 * @since 3.0.0
     137 * @since x.y.z Added the return value.
    131138 *
    132139 * @param string $slug The slug name for the generic template.
    133140 * @param string $name The name of the specialised template.
     141 * @return string The template filename if one is located.
    134142 */
    135143function get_template_part( $slug, $name = null ) {
    136144        /**
     
    154162
    155163        $templates[] = "{$slug}.php";
    156164
    157         locate_template( $templates, true, false );
     165        return locate_template( $templates, true, false );
    158166}
    159167
    160168/**