Changeset 9091 for trunk/src/bp-core/bp-core-template.php
- Timestamp:
- 10/26/2014 06:42:40 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-template.php
r9049 r9091 1082 1082 * @return bool Returns true if the component matches, or else false. 1083 1083 */ 1084 function bp_is_current_component( $component ) {1085 global $wp_query; 1086 1084 function bp_is_current_component( $component = '' ) { 1085 1086 // Default is no match. We'll check a few places for matches 1087 1087 $is_current_component = false; 1088 1088 … … 1099 1099 $bp = buddypress(); 1100 1100 1101 // Only check if BuddyPress found a current_component 1101 1102 if ( ! empty( $bp->current_component ) ) { 1102 1103 … … 1137 1138 break; 1138 1139 } 1139 }1140 }1141 1142 // Page template fallback check if $bp->current_component is empty1143 } elseif ( !is_admin() && is_a( $wp_query, 'WP_Query' ) && is_page() ) {1144 global $wp_query;1145 1146 $page = $wp_query->get_queried_object();1147 if ( isset( $page->ID ) ) {1148 $custom_fields = get_post_custom_values( '_wp_page_template', $page->ID );1149 $page_template = $custom_fields[0];1150 1151 // Component name is in the page template name1152 if ( !empty( $page_template ) && strstr( strtolower( $page_template ), strtolower( $component ) ) ) {1153 $is_current_component = true;1154 1140 } 1155 1141 }
Note: See TracChangeset
for help on using the changeset viewer.