Changeset 5827 for trunk/src/includes/search/template.php
- Timestamp:
- 07/14/2015 12:31:42 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/search/template.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/search/template.php
r5770 r5827 31 31 * @uses bbp_get_search_terms() To get the search terms 32 32 * @uses WP_Query To make query and get the search results 33 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks33 * @uses bbp_use_pretty_urls() To check if the site is using pretty URLs 34 34 * @uses bbp_get_search_url() To get the forum search url 35 35 * @uses paginate_links() To paginate search results … … 40 40 */ 41 41 function bbp_has_search_results( $args = array() ) { 42 global $wp_rewrite;43 42 44 43 /** Defaults **************************************************************/ … … 115 114 116 115 // If pretty permalinks are enabled, make our pagination pretty 117 if ( $wp_rewrite->using_permalinks() ) {116 if ( bbp_use_pretty_urls() ) { 118 117 119 118 // Shortcode territory … … 127 126 128 127 // Add pagination base 129 $base = $base . user_trailingslashit( $wp_rewrite->pagination_base. '/%#%/' );128 $base = $base . user_trailingslashit( bbp_get_paged_slug() . '/%#%/' ); 130 129 131 130 // Unpretty permalinks … … 154 153 155 154 // Remove first page from pagination 156 if ( $wp_rewrite->using_permalinks() ) {157 $bbp->search_query->pagination_links = str_replace( $wp_rewrite->pagination_base. '/1/', '', $bbp->search_query->pagination_links );155 if ( bbp_use_pretty_urls() ) { 156 $bbp->search_query->pagination_links = str_replace( bbp_get_paged_slug() . '/1/', '', $bbp->search_query->pagination_links ); 158 157 } else { 159 158 $bbp->search_query->pagination_links = str_replace( '&paged=1', '', $bbp->search_query->pagination_links ); … … 264 263 */ 265 264 function bbp_get_search_url() { 266 global $wp_rewrite;267 265 268 266 // Pretty permalinks 269 if ( $wp_rewrite->using_permalinks() ) { 270 $url = $wp_rewrite->root . bbp_get_search_slug(); 271 $url = home_url( user_trailingslashit( $url ) ); 267 if ( bbp_use_pretty_urls() ) { 268 $url = bbp_get_root_url() . bbp_get_search_slug(); 269 $url = user_trailingslashit( $url ); 270 $url = home_url( $url ); 272 271 273 272 // Unpretty permalinks 274 273 } else { 275 $url = add_query_arg( array( bbp_get_search_rewrite_id() => '' ), home_url( '/' ) ); 274 $url = add_query_arg( array( 275 bbp_get_search_rewrite_id() => '' 276 ), home_url( '/' ) ); 276 277 } 277 278 … … 302 303 */ 303 304 function bbp_get_search_results_url() { 304 global $wp_rewrite;305 305 306 306 // Get the search terms … … 308 308 309 309 // Pretty permalinks 310 if ( $wp_rewrite->using_permalinks() ) {310 if ( bbp_use_pretty_urls() ) { 311 311 312 312 // Root search URL 313 $url = $wp_rewrite->root. bbp_get_search_slug();313 $url = bbp_get_root_url() . bbp_get_search_slug(); 314 314 315 315 // Append search terms 316 316 if ( ! empty( $search_terms ) ) { 317 $url = trailingslashit( $url ) . u ser_trailingslashit( urlencode( $search_terms ));317 $url = trailingslashit( $url ) . urlencode( $search_terms ); 318 318 } 319 319 320 320 // Run through home_url() 321 $url = home_url( user_trailingslashit( $url ) ); 321 $url = user_trailingslashit( $url ); 322 $url = home_url( $url ); 322 323 323 324 // Unpretty permalinks 324 325 } else { 325 $url = add_query_arg( array( bbp_get_search_rewrite_id() => urlencode( $search_terms ) ), home_url( '/' ) ); 326 $url = add_query_arg( array( 327 bbp_get_search_rewrite_id() => urlencode( $search_terms ) 328 ), home_url( '/' ) ); 326 329 } 327 330
Note: See TracChangeset
for help on using the changeset viewer.