Changeset 13686
- Timestamp:
- 01/01/2024 10:56:10 AM (12 months ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-actions.php
r13490 r13686 165 165 */ 166 166 add_action( 'bp_after_setup_theme', 'bp_check_theme_template_pack_dependency', -10 ); 167 add_action( 'bp_after_setup_theme', 'bp_set_block_theme_compat', 0 ); 167 168 add_action( 'bp_after_setup_theme', 'bp_load_theme_functions', 1 ); 168 169 add_action( 'bp_after_setup_theme', 'bp_register_theme_compat_default_features', 10 ); -
trunk/src/bp-core/bp-core-catchuri.php
r13522 r13686 70 70 * 71 71 * @since 1.0.0 72 * @since 14.0.0 Uses `locate_block_template()` to support BuddyPress Block only Themes. 72 73 * 73 74 * @param array $templates Array of templates to attempt to load. … … 95 96 // Only perform template lookup for bp-default themes. 96 97 if ( ! bp_use_theme_compat_with_current_theme() ) { 97 $template = locate_template( (array) $filtered_templates, false ); 98 if ( bp_theme_compat_is_block_theme() ) { 99 // Prevent BuddyPress components from using the BP Theme Compat feature. 100 remove_all_actions( 'bp_setup_theme_compat' ); 101 102 $block_templates = array(); 103 foreach ( (array) $templates as $template ) { 104 $block_templates[] = 'buddypress/' . $template; 105 } 106 107 $template_type = 'buddypress'; 108 $block_templates[] = $template_type; 109 110 $template = locate_block_template( '', $template_type, $block_templates ); 111 112 } else { 113 $template = locate_template( (array) $filtered_templates, false ); 114 } 98 115 99 116 // Theme compat doesn't require a template lookup. … … 124 141 } 125 142 126 if ( ! empty( $located_template ) ) {143 if ( ! empty( $located_template ) ) { 127 144 // Template was located, lets set this as a valid page and not a 404. 128 145 status_header( 200 ); -
trunk/src/bp-core/bp-core-template-loader.php
r13519 r13686 827 827 ) ); 828 828 } 829 830 /** 831 * Sets Block Theme compatibility if it supports BuddyPress. 832 * 833 * @since 14.0.0 834 */ 835 function bp_set_block_theme_compat() { 836 if ( bp_is_running_wp( '5.9.0', '>=' ) && wp_is_block_theme() && current_theme_supports( 'buddypress' ) ) { 837 bp_deregister_template_stack( 'get_stylesheet_directory', 10 ); 838 bp_deregister_template_stack( 'get_template_directory', 12 ); 839 840 $block_theme = wp_get_theme(); 841 $theme_compat_id = $block_theme->stylesheet; 842 843 bp_register_theme_package( 844 array( 845 'id' => $theme_compat_id, 846 'name' => $block_theme->get( 'Name' ), 847 'version' => $block_theme->get( 'Version' ), 848 'dir' => '', 849 'url' => '', 850 'is_block_theme' => true, 851 ) 852 ); 853 854 bp_setup_theme_compat( $theme_compat_id ); 855 } 856 } -
trunk/src/bp-core/bp-core-theme-compatibility.php
r13395 r13686 1042 1042 } 1043 1043 } 1044 1045 /** 1046 * Informs about whether current theme compat is about a block theme. 1047 * 1048 * @since 14.0.0 1049 * 1050 * @return boolean True if current theme compat is about a block theme. 1051 * False otherwise. 1052 */ 1053 function bp_theme_compat_is_block_theme() { 1054 $theme = buddypress()->theme_compat->theme; 1055 1056 return isset( $theme->is_block_theme ) && $theme->is_block_theme; 1057 }
Note: See TracChangeset
for help on using the changeset viewer.