WordPress.org

Make WordPress Core

Ticket #32096: 32096.5.diff

File 32096.5.diff, 2.0 KB (added by ianbelanger, 5 months ago)

Refresh of 32096.4.diff and fixes typo in Twenty Thirteen functions.php

  • src/wp-content/themes/twentyfifteen/functions.php

     
    535535}
    536536add_filter( 'widget_tag_cloud_args', 'twentyfifteen_widget_tag_cloud_args' );
    537537
     538/**
     539 * Prevents author-bio.php from being accessed directly if user_nicename is `bio`
     540 *
     541 * @since Twenty Fifteen 2.5
     542 *
     543 * @param string @template Template file
     544 * @return string Replacement template file
     545 */
     546function twentyfifteen_author_bio_template( $template ) {
     547        $author_posts_number = get_the_author_posts();
     548
     549        if ( get_the_author_meta( 'user_nicename' ) === 'bio' || $author_posts_number === 0 ) {
     550        $new_template = locate_template( array( 'archive.php' ) );
     551
     552                if ( '' != $new_template ) {
     553                        return $new_template;
     554                }
     555
     556        }
     557
     558        return $template;
     559}
     560add_filter( 'template_include', 'twentyfifteen_author_bio_template' );
     561
    538562
    539563/**
    540564 * Implement the Custom Header feature.
  • src/wp-content/themes/twentythirteen/functions.php

     
    796796                do_action( 'wp_body_open' );
    797797        }
    798798endif;
     799
     800/**
     801 * Prevents author-bio.php from being accessed directly if user_nicename is `bio`
     802 *
     803 * @since Twenty Thirteen 2.9
     804 *
     805 * @param string @template Template file
     806 * @return string Replacement template file
     807 */
     808function twentythirteen_author_bio_template( $template ) {
     809        $author_posts_number = get_the_author_posts();
     810
     811        if ( get_the_author_meta( 'user_nicename' ) === 'bio' || $author_posts_number === 0 ) {
     812        $new_template = locate_template( array( 'archive.php' ) );
     813
     814                if ( '' != $new_template ) {
     815                        return $new_template;
     816                }
     817
     818        }
     819
     820        return $template;
     821}
     822add_filter( 'template_include', 'twentythirteen_author_bio_template' );