Skip to:
Content

BuddyPress.org

Ticket #6230: bp-core-theme-compatibility.php.diff

File bp-core-theme-compatibility.php.diff, 761 bytes (added by mikelopez, 5 years ago)

Set proper page ID if one exists for the current component in bp_theme_compat_reset_post()

  • bp-core-theme-compatibility.php

     
    453453 *        properties of {@link WP_Post}; see that class for more details.
    454454 */
    455455function bp_theme_compat_reset_post( $args = array() ) {
    456         global $wp_query, $post;
     456        global $wp_query, $post, $bp;
     457
     458        // set proper page ID if one exists for the current component
     459        if ( empty( $args['ID'] ) ) {
     460                $page_ids = bp_get_option( 'bp-pages' );
     461                if ( isset( $page_ids[$bp->current_component] ) ) {
     462                        $args['ID'] = $page_ids[$bp->current_component];
     463                }
     464        }
    457465
    458466        // Switch defaults if post is set
    459467        if ( isset( $wp_query->post ) ) {