Use pluggable functions only around functions which cannot be unhooked (#1480)

This commit is contained in:
Ismail El Korchi 2022-01-01 22:15:14 +01:00 committed by GitHub
parent d6ccb97e0b
commit 8852c27641
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 99 additions and 99 deletions

View file

@ -12,15 +12,14 @@ if ( ! defined( '_S_VERSION' ) ) {
define( '_S_VERSION', '1.0.0' ); define( '_S_VERSION', '1.0.0' );
} }
if ( ! function_exists( '_s_setup' ) ) : /**
/**
* Sets up theme defaults and registers support for various WordPress features. * Sets up theme defaults and registers support for various WordPress features.
* *
* Note that this function is hooked into the after_setup_theme hook, which * Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such * runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails. * as indicating support for post thumbnails.
*/ */
function _s_setup() { function _s_setup() {
/* /*
* Make theme available for translation. * Make theme available for translation.
* Translations can be filed in the /languages/ directory. * Translations can be filed in the /languages/ directory.
@ -100,8 +99,7 @@ if ( ! function_exists( '_s_setup' ) ) :
'flex-height' => true, 'flex-height' => true,
) )
); );
} }
endif;
add_action( 'after_setup_theme', '_s_setup' ); add_action( 'after_setup_theme', '_s_setup' );
/** /**

View file

@ -50,10 +50,11 @@ function _s_jetpack_setup() {
} }
add_action( 'after_setup_theme', '_s_jetpack_setup' ); add_action( 'after_setup_theme', '_s_jetpack_setup' );
/** if ( ! function_exists( '_s_infinite_scroll_render' ) ) :
/**
* Custom render function for Infinite Scroll. * Custom render function for Infinite Scroll.
*/ */
function _s_infinite_scroll_render() { function _s_infinite_scroll_render() {
while ( have_posts() ) { while ( have_posts() ) {
the_post(); the_post();
if ( is_search() ) : if ( is_search() ) :
@ -62,4 +63,5 @@ function _s_infinite_scroll_render() {
get_template_part( 'template-parts/content', get_post_type() ); get_template_part( 'template-parts/content', get_post_type() );
endif; endif;
} }
} }
endif;