Skip to:
Content

BuddyPress.org

Ticket #5418: 5418.02.patch

File 5418.02.patch, 948 bytes (added by r-a-y, 10 years ago)
  • bp-core/bp-core-theme-compatibility.php

    function bp_theme_compat_loop_end( $query ) { 
    877877        unset( $bp->theme_compat->is_page_toggled );
    878878}
    879879add_action( 'loop_end', 'bp_theme_compat_loop_end' );
     880
     881/**
     882 * On a BuddyPress page, force post type to 'page' to avoid template issues.
     883 *
     884 * Most notably with is_singular( get_post_type() ) calls since BP's post
     885 * types defined in {@link bp_theme_compat_reset_post()} do not exist.
     886 *
     887 * @since BuddyPress (2.0.0)
     888 *
     889 * @param object $query The WP_Query object.
     890 */
     891function bp_theme_compat_loop_start( $query ) {
     892
     893        // theme compat isn't on, so stop now!
     894        if ( ! bp_is_theme_compat_active() ) {
     895                return;
     896        }
     897
     898        $query->post->post_type = 'page';
     899}
     900add_action( 'loop_start', 'bp_theme_compat_loop_start' );