Skip to content

Commit

Permalink
Rename theme compat filter to classic_theme_helper_theme_compat_files…
Browse files Browse the repository at this point in the history
… to prevent loading conflicts with the Jetpack module filter which will remain.
  • Loading branch information
coder-karen committed Feb 7, 2025
1 parent d660599 commit 0a7fff6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions projects/packages/classic-theme-helper/src/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function init() {
self::$instance = new Main();
self::$instance->load_modules();
add_action( 'init', array( __CLASS__, 'jetpack_load_theme_tools' ), 30 );
add_action( 'after_setup_theme', array( __CLASS__, 'jetpack_load_theme_compat' ), -1 );
add_action( 'after_setup_theme', array( __CLASS__, 'classic_theme_helper_load_theme_compat' ), -1 );
}

return self::$instance;
Expand Down Expand Up @@ -76,15 +76,15 @@ public static function jetpack_load_theme_tools() {
/**
* Load theme compat file if it exists.
*/
public static function jetpack_load_theme_compat() {
public static function classic_theme_helper_load_theme_compat() {

/**
* Filter theme compat files.
*
* Themes can add their own compat files here if they like. For example:
*
* add_filter( 'jetpack_theme_compat_files', 'mytheme_jetpack_compat_file' );
* function mytheme_jetpack_compat_file( $files ) {
* add_filter( 'classic_theme_helper_theme_compat_files', 'mytheme_classic_theme_helper_theme_compat_file' );
* function mytheme_classic_theme_helper_theme_compat_file( $files ) {
* $files['mytheme'] = locate_template( 'jetpack-compat.php' );
* return $files;
* }
Expand All @@ -94,7 +94,7 @@ public static function jetpack_load_theme_compat() {
* @param array Associative array of theme compat files to load.
*/
$compat_files = apply_filters(
'jetpack_theme_compat_files',
'classic_theme_helper_theme_compat_files',
array(
'twentyfourteen' => __DIR__ . '/compat/twentyfourteen.php',
'twentyfifteen' => __DIR__ . '/compat/twentyfifteen.php',
Expand All @@ -105,10 +105,10 @@ public static function jetpack_load_theme_compat() {
)
);

self::jetpack_require_compat_file( get_stylesheet(), $compat_files );
self::classic_theme_helper_require_compat_file( get_stylesheet(), $compat_files );

if ( is_child_theme() ) {
self::jetpack_require_compat_file( get_template(), $compat_files );
self::classic_theme_helper_require_compat_file( get_template(), $compat_files );
}
}

Expand All @@ -119,7 +119,7 @@ public static function jetpack_load_theme_compat() {
* @param array $files Array of files to check in.
* @return void|WP_Error
*/
private static function jetpack_require_compat_file( $key, $files ) {
private static function classic_theme_helper_require_compat_file( $key, $files ) {
if ( ! is_string( $key ) ) {
return new WP_Error( 'key_not_string', 'The specified key is not actually a string.', compact( 'key' ) );
}
Expand Down

0 comments on commit 0a7fff6

Please sign in to comment.