Ticket #950: fix-bp_dtheme_show_home_blog.patch
File fix-bp_dtheme_show_home_blog.patch, 1.6 KB (added by , 15 years ago) |
---|
-
bp-themes/bp-sn-framework/functions.php
51 51 52 52 /* Make sure the blog index page shows under /[HOME_BLOG_SLUG] if enabled */ 53 53 function bp_dtheme_show_home_blog() { 54 global $bp, $query_string ;55 54 global $bp, $query_string, $paged; 55 56 56 if ( $bp->current_component == BP_HOME_BLOG_SLUG && ( !$bp->current_action || 'page' == $bp->current_action ) ) { 57 57 $query_string = preg_replace( '/pagename=' . BP_HOME_BLOG_SLUG . '/', '', $query_string ); 58 query_posts($query_string); 59 58 59 if ( 'page' == $bp->current_action) { 60 if ( !$bp->action_variables[0] || $bp->action_variables[1] || (int) $bp->action_variables[0] < 2 ) { 61 locate_template( array( '404.php' ), true ); 62 die; 63 } 64 if ( $paged != (int) $bp->action_variables[0] ) 65 $paged = (int) $bp->action_variables[0]; 66 if ( $query_string ) $query_string .= '&'; 67 $query_string .= 'paged=' . $paged; 68 } 69 query_posts( $query_string ); 70 60 71 bp_core_load_template( 'index', true ); 61 72 } 62 73 } 63 74 add_action( 'wp', 'bp_dtheme_show_home_blog', 2 ); 64 75 76 function bp_dtheme_filter_home_query( $query ) { 77 global $bp; 78 if ( $bp->current_component != BP_HOME_BLOG_SLUG ) 79 return $query; 80 remove_filter( 'posts_request', 'bp_dtheme_filter_home_query', 0 ); 81 // nullify the initial query 82 return; 83 } 84 add_filter( 'posts_request', 'bp_dtheme_filter_home_query', 0 ); 85 65 86 ?> 87 No newline at end of file