Ticket #1575: 1575.5.diff
File 1575.5.diff, 50.6 KB (added by , 13 years ago) |
---|
-
bbpress.php
221 221 $this->trash_status_id = apply_filters( 'bbp_trash_post_status', 'trash' ); 222 222 223 223 // Other identifiers 224 $this->user_id = apply_filters( 'bbp_user_id', 'bbp_user' ); 225 $this->tops_id = apply_filters( 'bbp_tops_id', 'bbp_tops' ); 226 $this->reps_id = apply_filters( 'bbp_reps_id', 'bbp_reps' ); 227 $this->favs_id = apply_filters( 'bbp_favs_id', 'bbp_favs' ); 228 $this->subs_id = apply_filters( 'bbp_subs_id', 'bbp_subs' ); 229 $this->view_id = apply_filters( 'bbp_view_id', 'bbp_view' ); 230 $this->edit_id = apply_filters( 'bbp_edit_id', 'edit' ); 224 $this->user_id = apply_filters( 'bbp_user_id', 'bbp_user' ); 225 $this->tops_id = apply_filters( 'bbp_tops_id', 'bbp_tops' ); 226 $this->reps_id = apply_filters( 'bbp_reps_id', 'bbp_reps' ); 227 $this->favs_id = apply_filters( 'bbp_favs_id', 'bbp_favs' ); 228 $this->subs_id = apply_filters( 'bbp_subs_id', 'bbp_subs' ); 229 $this->view_id = apply_filters( 'bbp_view_id', 'bbp_view' ); 230 $this->search_id = apply_filters( 'bbp_search_id', 'bbp_search' ); 231 $this->edit_id = apply_filters( 'bbp_edit_id', 'edit' ); 231 232 232 233 /** Queries ***********************************************************/ 233 234 … … 239 240 $this->forum_query = new stdClass(); // Main forum query 240 241 $this->topic_query = new stdClass(); // Main topic query 241 242 $this->reply_query = new stdClass(); // Main reply query 243 $this->search_query = new stdClass(); // Main search query 242 244 243 245 /** Theme Compat ******************************************************/ 244 246 … … 309 311 require( $this->includes_dir . 'replies/functions.php' ); 310 312 require( $this->includes_dir . 'replies/template-tags.php' ); 311 313 314 // Search 315 require( $this->includes_dir . 'search/functions.php' ); 316 require( $this->includes_dir . 'search/template-tags.php' ); 317 312 318 // Users 313 319 require( $this->includes_dir . 'users/capabilities.php' ); 314 320 require( $this->includes_dir . 'users/functions.php' ); … … 358 364 'register_views', // Register the views (no-replies) 359 365 'register_theme_packages', // Register bundled theme packages (bbp-theme-compat/bbp-themes) 360 366 'load_textdomain', // Load textdomain (bbpress) 361 'add_rewrite_tags', // Add rewrite tags (view|user|edit )362 'generate_rewrite_rules' // Generate rewrite rules (view|edit )367 'add_rewrite_tags', // Add rewrite tags (view|user|edit|search) 368 'generate_rewrite_rules' // Generate rewrite rules (view|edit|search) 363 369 ); 364 370 365 371 // Add the actions … … 832 838 public static function add_rewrite_tags() { 833 839 add_rewrite_tag( '%%' . bbp_get_view_rewrite_id() . '%%', '([^/]+)' ); // View Page tag 834 840 add_rewrite_tag( '%%' . bbp_get_edit_rewrite_id() . '%%', '([1]{1,})' ); // Edit Page tag 841 add_rewrite_tag( '%%' . bbp_get_search_rewrite_id() . '%%', '([^/]+)' ); // Search Results tag 835 842 add_rewrite_tag( '%%' . bbp_get_user_rewrite_id() . '%%', '([^/]+)' ); // User Profile tag 836 843 add_rewrite_tag( '%%' . bbp_get_user_favorites_rewrite_id() . '%%', '([1]{1,})' ); // User Favorites tag 837 844 add_rewrite_tag( '%%' . bbp_get_user_subscriptions_rewrite_id() . '%%', '([1]{1,})' ); // User Subscriptions tag … … 853 860 public static function generate_rewrite_rules( $wp_rewrite ) { 854 861 855 862 // Slugs 856 $view_slug = bbp_get_view_slug(); 857 $user_slug = bbp_get_user_slug(); 863 $view_slug = bbp_get_view_slug(); 864 $search_slug = bbp_get_search_slug(); 865 $user_slug = bbp_get_user_slug(); 858 866 859 867 // Unique rewrite ID's 860 $edit_id = bbp_get_edit_rewrite_id(); 861 $view_id = bbp_get_view_rewrite_id(); 862 $user_id = bbp_get_user_rewrite_id(); 863 $favs_id = bbp_get_user_favorites_rewrite_id(); 864 $subs_id = bbp_get_user_subscriptions_rewrite_id(); 865 $tops_id = bbp_get_user_topics_rewrite_id(); 866 $reps_id = bbp_get_user_replies_rewrite_id(); 868 $edit_id = bbp_get_edit_rewrite_id(); 869 $view_id = bbp_get_view_rewrite_id(); 870 $search_id = bbp_get_search_rewrite_id(); 871 $user_id = bbp_get_user_rewrite_id(); 872 $favs_id = bbp_get_user_favorites_rewrite_id(); 873 $subs_id = bbp_get_user_subscriptions_rewrite_id(); 874 $tops_id = bbp_get_user_topics_rewrite_id(); 875 $reps_id = bbp_get_user_replies_rewrite_id(); 867 876 868 877 // Rewrite rule matches used repeatedly below 869 $root_rule = '/([^/]+)/?$';870 $edit_rule = '/([^/]+)/edit/?$';871 $feed_rule = '/([^/]+)/feed/?$';872 $page_rule = '/([^/]+)/page/?([0-9]{1,})/?$';878 $root_rule = '/([^/]+)/?$'; 879 $edit_rule = '/([^/]+)/edit/?$'; 880 $feed_rule = '/([^/]+)/feed/?$'; 881 $page_rule = '/([^/]+)/page/?([0-9]{1,})/?$'; 873 882 874 883 // User profile rules 875 884 $tops_rule = '/([^/]+)/topics/?$'; … … 907 916 $view_slug . $page_rule => 'index.php?' . $view_id . '=' . $wp_rewrite->preg_index( 1 ) . '&paged=' . $wp_rewrite->preg_index( 2 ), 908 917 $view_slug . $feed_rule => 'index.php?' . $view_id . '=' . $wp_rewrite->preg_index( 1 ) . '&feed=' . $wp_rewrite->preg_index( 2 ), 909 918 $view_slug . $root_rule => 'index.php?' . $view_id . '=' . $wp_rewrite->preg_index( 1 ), 919 920 // Search All 921 $search_slug . $page_rule => 'index.php?' . $search_id . '=' . $wp_rewrite->preg_index( 1 ) . '&paged=' . $wp_rewrite->preg_index( 2 ), 922 $search_slug . $root_rule => 'index.php?' . $search_id . '=' . $wp_rewrite->preg_index( 1 ), 923 $search_slug . '/?$' => 'index.php?' . $search_id . '=' . $wp_rewrite->preg_index( 1 ), 910 924 ); 911 925 912 926 // Merge bbPress rules with existing -
includes/admin/settings.php
299 299 'callback' => 'bbp_admin_setting_callback_view_slug', 300 300 'sanitize_callback' => 'sanitize_title', 301 301 'args' => array() 302 ), 303 304 // Search slug setting 305 '_bbp_search_slug' => array( 306 'title' => __( 'Search slug', 'bbpress' ), 307 'callback' => 'bbp_admin_setting_callback_search_slug', 308 'sanitize_callback' => 'sanitize_title', 309 'args' => array() 302 310 ) 303 311 ), 304 312 … … 883 891 bbp_form_slug_conflict_check( '_bbp_view_slug', 'view' ); 884 892 } 885 893 894 /** 895 * Search slug setting field 896 * 897 * @uses bbp_form_option() To output the option value 898 */ 899 function bbp_admin_setting_callback_search_slug() { 900 ?> 901 902 <input name="_bbp_search_slug" type="text" id="_bbp_search_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_search_slug', 'search', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_search_slug' ); ?> /> 903 904 <?php 905 // Slug Check 906 bbp_form_slug_conflict_check( '_bbp_search_slug', 'search' ); 907 } 908 886 909 /** BuddyPress ****************************************************************/ 887 910 888 911 /** -
includes/common/shortcodes.php
79 79 80 80 'bbp-single-view' => array( $this, 'display_view' ), // Single view 81 81 82 /** Search ********************************************************/ 83 84 'bbp-search' => array( $this, 'display_search' ), // Search 85 82 86 /** Account *******************************************************/ 83 87 84 88 'bbp-login' => array( $this, 'display_login' ), // Login … … 114 118 $bbp = bbpress(); 115 119 116 120 // Unset global queries 117 $bbp->forum_query = new stdClass; 118 $bbp->topic_query = new stdClass; 119 $bbp->reply_query = new stdClass; 121 $bbp->forum_query = new stdClass; 122 $bbp->topic_query = new stdClass; 123 $bbp->reply_query = new stdClass; 124 $bbp->search_query = new stdClass; 120 125 121 126 // Unset global ID's 122 127 $bbp->current_forum_id = 0; … … 602 607 return $this->end(); 603 608 } 604 609 610 /** Search ****************************************************************/ 611 612 /** 613 * Display the contents of search results in an output buffer and return to 614 * ensure that post/page contents are displayed first. 615 * 616 * @param array $attr 617 * @param string $content 618 * @uses bbp_search_query() 619 * @uses get_template_part() 620 */ 621 public function display_search( $attr, $content = '' ) { 622 623 // Set passed attribute to $search_terms for clarity 624 $search_terms = $attr['search']; 625 626 // Start output buffer 627 $this->start( 'bbp_search' ); 628 629 // Unset globals 630 $this->unset_globals(); 631 632 // Load the search 633 bbp_search_query( array( 's' => $search_terms ) ); 634 635 // Output template 636 bbp_get_template_part( 'content', 'search' ); 637 638 // Return contents of output buffer 639 return $this->end(); 640 } 641 605 642 /** Account ***************************************************************/ 606 643 607 644 /** -
includes/common/template-tags.php
784 784 } 785 785 786 786 /** 787 * Check if current page is a search page 788 * 789 * @global WP_Query $wp_query To check if WP_Query::bbp_is_search is true 790 * @uses bbp_is_query_name() To get the query name 791 * @return bool Is it a search page? 792 */ 793 function bbp_is_search() { 794 global $wp_query; 795 796 // Assume false 797 $retval = false; 798 799 // Check query 800 if ( !empty( $wp_query->bbp_is_search ) && ( true == $wp_query->bbp_is_search ) ) 801 $retval = true; 802 803 // Check query name 804 if ( empty( $retval ) && bbp_is_query_name( 'bbp_search' ) ) 805 $retval = true; 806 807 // Check $_GET 808 if ( empty( $retval ) && isset( $_GET[bbp_get_search_rewrite_id()] ) ) 809 $retval = true; 810 811 return (bool) apply_filters( 'bbp_is_search', $retval ); 812 } 813 814 /** 787 815 * Check if current page is an edit page 788 816 * 789 817 * @since bbPress (r3585) … … 2409 2437 // Views 2410 2438 } elseif ( bbp_is_single_view() ) { 2411 2439 $title = sprintf( __( 'View: %s', 'bbpress' ), bbp_get_view_title() ); 2440 2441 /** Search ****************************************************************/ 2442 2443 // Search 2444 } elseif ( bbp_is_search() ) { 2445 $title = bbp_get_search_title(); 2412 2446 } 2413 2447 2414 2448 // Filter the raw title -
includes/common/widgets.php
320 320 } 321 321 322 322 /** 323 * bbPress Search Widget 324 * 325 * Adds a widget which displays the forum search form 326 * 327 * @uses WP_Widget 328 */ 329 class BBP_Search_Widget extends WP_Widget { 330 331 /** 332 * bbPress Search Widget 333 * 334 * Registers the search widget 335 * 336 * @uses apply_filters() Calls 'bbp_search_widget_options' with the 337 * widget options 338 */ 339 public function __construct() { 340 $widget_ops = apply_filters( 'bbp_search_widget_options', array( 341 'classname' => 'widget_display_search', 342 'description' => __( 'The bbPress forum search form.', 'bbpress' ) 343 ) ); 344 345 parent::__construct( false, __( '(bbPress) Forum Search Form', 'bbpress' ), $widget_ops ); 346 } 347 348 /** 349 * Register the widget 350 * 351 * @uses register_widget() 352 */ 353 public static function register_widget() { 354 register_widget( 'BBP_Search_Widget' ); 355 } 356 357 /** 358 * Displays the output, the search form 359 * 360 */ 361 public function widget( $args, $instance ) { 362 363 // Typical WordPress filter 364 $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); 365 366 // bbPress filter 367 $title = apply_filters( 'bbp_search_widget_title', $instance['title'], $instance, $this->id_base ); 368 369 echo $args['before_widget']; 370 echo $args['before_title'] . $title . $args['after_title']; 371 372 bbp_get_template_part( 'form', 'search' ); 373 374 echo $args['after_widget']; 375 } 376 377 /** 378 * Update the widget options 379 * 380 * @param array $new_instance The new instance options 381 * @param array $old_instance The old instance options 382 */ 383 public function update( $new_instance, $old_instance ) { 384 $instance = $old_instance; 385 $instance['title'] = strip_tags( $new_instance['title'] ); 386 387 return $instance; 388 } 389 390 /** 391 * Output the search widget options form 392 * 393 * @param $instance Instance 394 * @uses BBP_Search_Widget::get_field_id() To output the field id 395 * @uses BBP_Search_Widget::get_field_name() To output the field name 396 */ 397 public function form( $instance ) { 398 $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; ?> 399 400 <p> 401 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> 402 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /> 403 </label> 404 </p> 405 406 <?php 407 } 408 } 409 410 /** 323 411 * bbPress Forum Widget 324 412 * 325 413 * Adds a widget which displays the forum list -
includes/core/actions.php
138 138 // Widgets 139 139 add_action( 'bbp_widgets_init', array( 'BBP_Login_Widget', 'register_widget' ), 10 ); 140 140 add_action( 'bbp_widgets_init', array( 'BBP_Views_Widget', 'register_widget' ), 10 ); 141 add_action( 'bbp_widgets_init', array( 'BBP_Search_Widget', 'register_widget' ), 10 ); 141 142 add_action( 'bbp_widgets_init', array( 'BBP_Forums_Widget', 'register_widget' ), 10 ); 142 143 add_action( 'bbp_widgets_init', array( 'BBP_Topics_Widget', 'register_widget' ), 10 ); 143 144 add_action( 'bbp_widgets_init', array( 'BBP_Replies_Widget', 'register_widget' ), 10 ); -
includes/core/functions.php
435 435 } 436 436 437 437 /** 438 * Return the enique ID for all edit rewrite rules (forum|topic|reply|tag|user)438 * Return the unique ID for all edit rewrite rules (forum|topic|reply|tag|user) 439 439 * 440 440 * @since bbPress (r3762) 441 441 * @return string … … 445 445 } 446 446 447 447 /** 448 * Return the unique ID for all search rewrite rules 449 * 450 * @return string 451 */ 452 function bbp_get_search_rewrite_id() { 453 return bbpress()->search_id; 454 } 455 456 /** 448 457 * Return the unique ID for user topics rewrite rules 449 458 * 450 459 * @since bbPress (r4321) -
includes/core/options.php
79 79 /** Other Slugs *******************************************************/ 80 80 81 81 '_bbp_view_slug' => 'view', // View slug 82 '_bbp_search_slug' => 'search', // Search slug 82 83 83 84 /** Topics ************************************************************/ 84 85 … … 499 500 return apply_filters( 'bbp_get_view_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_view_slug', $default ) ); 500 501 } 501 502 503 /** 504 * Return the search slug 505 * 506 * @return string 507 */ 508 function bbp_get_search_slug( $default = 'search' ) { 509 return apply_filters( 'bbp_get_search_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_search_slug', $default ) ); 510 } 511 502 512 /** Legacy ********************************************************************/ 503 513 504 514 /** -
includes/core/template-functions.php
257 257 * If it's a reply edit, WP_Query::bbp_is_reply_edit is set to true. 258 258 * 259 259 * If it's a view page, WP_Query::bbp_is_view is set to true 260 * If it's a search page, WP_Query::bbp_is_search is set to true 260 261 * 261 262 * @since bbPress (r2688) 262 263 * … … 291 292 return; 292 293 293 294 // Get query variables 294 $bbp_view = $posts_query->get( bbp_get_view_rewrite_id() ); 295 $bbp_user = $posts_query->get( bbp_get_user_rewrite_id() ); 296 $is_edit = $posts_query->get( bbp_get_edit_rewrite_id() ); 295 $bbp_view = $posts_query->get( bbp_get_view_rewrite_id() ); 296 $bbp_search = $posts_query->get( bbp_get_search_rewrite_id() ); 297 $bbp_user = $posts_query->get( bbp_get_user_rewrite_id() ); 298 $is_edit = $posts_query->get( bbp_get_edit_rewrite_id() ); 297 299 298 300 // It is a user page - We'll also check if it is user edit 299 301 if ( !empty( $bbp_user ) ) { … … 421 423 // We are in a custom topic view 422 424 $posts_query->bbp_is_view = true; 423 425 426 // Search Page 427 } elseif ( !empty( $bbp_search ) ) { 428 429 // Check if there are search query args set 430 $search_terms = bbp_get_search_terms(); 431 if ( !empty( $search_terms ) ) 432 $posts_query->bbp_search_terms = $search_terms; 433 434 // Correct is_home variable 435 $posts_query->is_home = false; 436 437 // We are in a search query 438 $posts_query->bbp_is_search = true; 439 424 440 // Forum/Topic/Reply Edit Page 425 441 } elseif ( !empty( $is_edit ) ) { 426 442 -
includes/core/template-loader.php
30 30 * @uses bbp_get_single_user_edit_template() To get user edit template 31 31 * @uses bbp_is_single_view() To check if page is single view 32 32 * @uses bbp_get_single_view_template() To get view template 33 * @uses bbp_is_search() To check if page is search 34 * @uses bbp_get_search_template() To get search template 33 35 * @uses bbp_is_forum_edit() To check if page is forum edit 34 36 * @uses bbp_get_forum_edit_template() To get forum edit template 35 37 * @uses bbp_is_topic_merge() To check if page is topic merge … … 63 65 // Single View 64 66 elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template() ) ) : 65 67 68 // Search 69 elseif ( bbp_is_search() && ( $new_template = bbp_get_search_template() ) ) : 70 66 71 // Forum edit 67 72 elseif ( bbp_is_forum_edit() && ( $new_template = bbp_get_forum_edit_template() ) ) : 68 73 … … 251 256 } 252 257 253 258 /** 259 * Get the search template 260 * 261 */ 262 function bbp_get_search_template() { 263 $templates = array( 264 'page-forum-search.php', // Single Search 265 'forum-search.php', // Search 266 ); 267 return bbp_get_query_template( 'single_search', $templates ); 268 } 269 270 /** 254 271 * Get the single forum template 255 272 * 256 273 * @since bbPress (r3922) -
includes/core/theme-compat.php
435 435 * @uses bbp_get_single_user_edit_template() To get user edit template 436 436 * @uses bbp_is_single_view() To check if page is single view 437 437 * @uses bbp_get_single_view_template() To get view template 438 * @uses bbp_is_search() To check if page is search 439 * @uses bbp_get_search_template() To get search template 438 440 * @uses bbp_is_forum_edit() To check if page is forum edit 439 441 * @uses bbp_get_forum_edit_template() To get forum edit template 440 442 * @uses bbp_is_topic_merge() To check if page is topic merge … … 591 593 'comment_status' => 'closed' 592 594 ) ); 593 595 596 /** Search ************************************************************/ 597 598 } elseif ( bbp_is_search() ) { 599 600 // Reset post 601 bbp_theme_compat_reset_post( array( 602 'ID' => 0, 603 'post_title' => bbp_get_search_title(), 604 'post_author' => 0, 605 'post_date' => 0, 606 'post_content' => '', 607 'post_type' => '', 608 'post_status' => bbp_get_public_status_id(), 609 'comment_status' => 'closed' 610 ) ); 611 594 612 /** Topic Tags ********************************************************/ 595 613 596 614 // Topic Tag Edit … … 824 842 } elseif ( bbp_is_single_view() ) { 825 843 $new_content = $bbp->shortcodes->display_view( array( 'id' => get_query_var( 'bbp_view' ) ) ); 826 844 845 /** Search ************************************************************/ 846 847 } elseif ( bbp_is_search() ) { 848 $new_content = $bbp->shortcodes->display_search( array( 'search' => get_query_var( 'bbp_search' ) ) ); 849 827 850 /** Topic Tags ********************************************************/ 828 851 829 852 // Show topics of tag -
includes/forums/template-tags.php
140 140 * @uses bbPress::forum_query::in_the_loop To check if we're in the loop 141 141 * @uses bbPress::forum_query::post::ID To get the forum id 142 142 * @uses WP_Query::post::ID To get the forum id 143 * @uses bbp_is_forum() To check if the search result is a forum 143 144 * @uses bbp_is_single_forum() To check if it's a forum page 144 145 * @uses bbp_is_single_topic() To check if it's a topic page 145 146 * @uses bbp_get_topic_forum_id() To get the topic forum id … … 161 162 } elseif ( !empty( $bbp->forum_query->in_the_loop ) && isset( $bbp->forum_query->post->ID ) ) { 162 163 $bbp_forum_id = $bbp->forum_query->post->ID; 163 164 165 // Currently inside a search loop 166 } elseif ( !empty( $bbp->search_query->in_the_loop ) && isset( $bbp->search_query->post->ID ) && bbp_is_forum( $bbp->search_query->post->ID ) ) { 167 $bbp_forum_id = $bbp->search_query->post->ID; 168 164 169 // Currently viewing a forum 165 170 } elseif ( bbp_is_single_forum() && !empty( $bbp->current_forum_id ) ) { 166 171 $bbp_forum_id = $bbp->current_forum_id; -
includes/replies/template-tags.php
223 223 * 224 224 * @param $reply_id Optional. Used to check emptiness 225 225 * @uses bbPress::reply_query::post::ID To get the reply id 226 * @uses bbp_is_reply() To check if it's a reply page 226 * @uses bbp_is_reply() To check if the search result is a reply 227 * @uses bbp_is_single_reply() To check if it's a reply page 227 228 * @uses bbp_is_reply_edit() To check if it's a reply edit page 228 229 * @uses get_post_field() To get the post's post type 229 230 * @uses WP_Query::post::ID To get the reply id … … 245 246 } elseif ( !empty( $bbp->reply_query->in_the_loop ) && isset( $bbp->reply_query->post->ID ) ) { 246 247 $bbp_reply_id = $bbp->reply_query->post->ID; 247 248 249 // Currently inside a search loop 250 } elseif ( !empty( $bbp->search_query->in_the_loop ) && isset( $bbp->search_query->post->ID ) && bbp_is_reply( $bbp->search_query->post->ID ) ) { 251 $bbp_reply_id = $bbp->search_query->post->ID; 252 248 253 // Currently viewing a forum 249 254 } elseif ( ( bbp_is_single_reply() || bbp_is_reply_edit() ) && !empty( $bbp->current_reply_id ) ) { 250 255 $bbp_reply_id = $bbp->current_reply_id; -
includes/search/functions.php
1 <?php 2 3 /** 4 * bbPress Search Functions 5 * 6 * @package bbPress 7 * @subpackage Functions 8 */ 9 10 // Exit if accessed directly 11 if ( !defined( 'ABSPATH' ) ) exit; 12 13 /** Query *********************************************************************/ 14 15 /** 16 * Run the search query 17 * 18 * @param mixed $new_args New arguments 19 * @uses bbp_get_search_query_args() To get the search query args 20 * @uses bbp_parse_args() To parse the args 21 * @uses bbp_has_search_results() To make the search query 22 * @return bool False if no results, otherwise if search results are there 23 */ 24 function bbp_search_query( $new_args = '' ) { 25 26 $query_args = bbp_get_search_query_args(); 27 if ( empty( $query_args ) ) 28 return false; 29 30 // Merge arguments 31 if ( !empty( $new_args ) ) { 32 $new_args = bbp_parse_args( $new_args, '', 'search_query' ); 33 $query_args = array_merge( $query_args, $new_args ); 34 } 35 36 return bbp_has_search_results( $query_args ); 37 } 38 39 /** 40 * Return the search's query args 41 * 42 * @uses bbp_get_search_terms() To get the search terms 43 * @return array Query arguments 44 */ 45 function bbp_get_search_query_args() { 46 47 // Get search terms 48 $search_terms = bbp_get_search_terms(); 49 $retval = !empty( $search_terms ) ? array( 's' => $search_terms ) : false; 50 51 return apply_filters( 'bbp_get_search_query_args', $retval ); 52 } 53 -
includes/search/template-tags.php
1 <?php 2 3 /** 4 * bbPress Search Template Tags 5 * 6 * @package bbPress 7 * @subpackage TemplateTags 8 */ 9 10 // Exit if accessed directly 11 if ( !defined( 'ABSPATH' ) ) exit; 12 13 /** Search Loop Functions *****************************************************/ 14 15 /** 16 * The main search loop. WordPress does the heavy lifting. 17 * 18 * @param mixed $args All the arguments supported by {@link WP_Query} 19 * @uses bbp_get_view_all() Are we showing all results? 20 * @uses bbp_get_public_status_id() To get the public status id 21 * @uses bbp_get_closed_status_id() To get the closed status id 22 * @uses bbp_get_spam_status_id() To get the spam status id 23 * @uses bbp_get_trash_status_id() To get the trash status id 24 * @uses bbp_get_forum_post_type() To get the forum post type 25 * @uses bbp_get_topic_post_type() To get the topic post type 26 * @uses bbp_get_reply_post_type() To get the reply post type 27 * @uses bbp_get_replies_per_page() To get the replies per page option 28 * @uses bbp_get_paged() To get the current page value 29 * @uses bbp_get_search_terms() To get the search terms 30 * @uses WP_Query To make query and get the search results 31 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks 32 * @uses bbp_get_search_url() To get the forum search url 33 * @uses paginate_links() To paginate search results 34 * @uses apply_filters() Calls 'bbp_has_search_results' with 35 * bbPress::search_query::have_posts() 36 * and bbPress::reply_query 37 * @return object Multidimensional array of search information 38 */ 39 function bbp_has_search_results( $args = '' ) { 40 global $wp_rewrite; 41 42 /** Defaults **************************************************************/ 43 44 // What are the default allowed statuses (based on user caps) 45 if ( bbp_get_view_all( 'edit_others_replies' ) ) { 46 $post_statuses = array( bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id() ); 47 } else { 48 $post_statuses = array( bbp_get_public_status_id(), bbp_get_closed_status_id() ); 49 } 50 51 $default_post_type = array( bbp_get_forum_post_type(), bbp_get_topic_post_type(), bbp_get_reply_post_type() ); 52 $default_post_status = join( ',', $post_statuses ); 53 54 // Default query args 55 $default = array( 56 'post_type' => $default_post_type, // Forums, topics, and replies 57 'post_status' => $default_post_status, // Of this status 58 'posts_per_page' => bbp_get_replies_per_page(), // This many 59 'paged' => bbp_get_paged(), // On this page 60 'orderby' => 'date', // Sorted by date 61 'order' => 'DESC', // Most recent first 62 's' => bbp_get_search_terms(), // This is a search 63 ); 64 65 /** Setup *****************************************************************/ 66 67 // Parse arguments against default values 68 $r = bbp_parse_args( $args, $default, 'has_search_results' ); 69 70 // Don't bother if we don't have search terms 71 if ( empty( $r['s'] ) ) 72 return false; 73 74 // Get bbPress 75 $bbp = bbpress(); 76 77 // Call the query 78 $bbp->search_query = new WP_Query( $r ); 79 80 // Add pagination values to query object 81 $bbp->search_query->posts_per_page = $r['posts_per_page']; 82 $bbp->search_query->paged = $r['paged']; 83 84 // Never home, regardless of what parse_query says 85 $bbp->search_query->is_home = false; 86 87 // Found posts 88 if ( !$bbp->search_query->found_posts ) 89 return false; 90 91 // Only add pagination is query returned results 92 if ( (int) $bbp->search_query->found_posts && (int) $bbp->search_query->posts_per_page ) { 93 94 // If pretty permalinks are enabled, make our pagination pretty 95 if ( $wp_rewrite->using_permalinks() ) { 96 97 // Search 98 $base = trailingslashit( bbp_get_search_url() ) . user_trailingslashit( $wp_rewrite->pagination_base . '/%#%/' ); 99 100 // Unpretty permalinks 101 } else { 102 $base = add_query_arg( 'paged', '%#%' ); 103 } 104 105 // Add args 106 $add_args = array( bbp_get_search_rewrite_id() => esc_attr( bbp_get_search_terms() ) ); 107 if ( bbp_get_view_all() ) 108 $add_args['view'] = 'all'; 109 110 // Add pagination to query object 111 $bbp->search_query->pagination_links = paginate_links( 112 apply_filters( 'bbp_search_results_pagination', array( 113 'base' => $base, 114 'format' => '', 115 'total' => ceil( (int) $bbp->search_query->found_posts / (int) $r['posts_per_page'] ), 116 'current' => (int) $bbp->search_query->paged, 117 'prev_text' => '←', 118 'next_text' => '→', 119 'mid_size' => 1, 120 'add_args' => $add_args, 121 ) ) 122 ); 123 124 // Remove first page from pagination 125 if ( $wp_rewrite->using_permalinks() ) { 126 $bbp->search_query->pagination_links = str_replace( $wp_rewrite->pagination_base . '/1/', '', $bbp->search_query->pagination_links ); 127 } else { 128 $bbp->search_query->pagination_links = str_replace( '&paged=1', '', $bbp->search_query->pagination_links ); 129 } 130 } 131 132 // Return object 133 return apply_filters( 'bbp_has_search_results', $bbp->search_query->have_posts(), $bbp->search_query ); 134 } 135 136 /** 137 * Whether there are more search results available in the loop 138 * 139 * @uses WP_Query bbPress::search_query::have_posts() To check if there are more 140 * search results available 141 * @return object Search information 142 */ 143 function bbp_search_results() { 144 145 // Put into variable to check against next 146 $have_posts = bbpress()->search_query->have_posts(); 147 148 // Reset the post data when finished 149 if ( empty( $have_posts ) ) 150 wp_reset_postdata(); 151 152 return $have_posts; 153 } 154 155 /** 156 * Loads up the current search result in the loop 157 * 158 * @uses WP_Query bbPress::search_query::the_post() To get the current search result 159 * @return object Search information 160 */ 161 function bbp_the_search_result() { 162 $search_result = bbpress()->search_query->the_post(); 163 164 // Reset each current (forum|topic|reply) id 165 bbpress()->current_forum_id = bbp_get_forum_id(); 166 bbpress()->current_topic_id = bbp_get_topic_id(); 167 bbpress()->current_reply_id = bbp_get_reply_id(); 168 169 return $search_result; 170 } 171 172 /** 173 * Output the search page title 174 * 175 * @uses bbp_get_search_title() 176 */ 177 function bbp_search_title() { 178 echo bbp_get_search_title(); 179 } 180 181 /** 182 * Get the search page title 183 * 184 * @uses bbp_get_search_terms() 185 */ 186 function bbp_get_search_title() { 187 188 // Get search terms 189 $search_terms = bbp_get_search_terms(); 190 191 // No search terms specified 192 if ( empty( $search_terms ) ) { 193 return __( 'Search', 'bbpress' ); 194 195 // Include search terms in title 196 } else { 197 return sprintf( __( "Search Results for '%s'", 'bbpress' ), esc_attr( $search_terms ) ); 198 } 199 } 200 201 /** 202 * Output the search url 203 * 204 * @uses bbp_get_search_url() To get the search url 205 */ 206 function bbp_search_url() { 207 echo bbp_get_search_url(); 208 } 209 /** 210 * Return the search url 211 * 212 * @uses user_trailingslashit() To fix slashes 213 * @uses trailingslashit() To fix slashes 214 * @uses bbp_get_forums_url() To get the root forums url 215 * @uses bbp_get_search_slug() To get the search slug 216 * @uses add_query_arg() To help make unpretty permalinks 217 * @return string Search url 218 */ 219 function bbp_get_search_url() { 220 global $wp_rewrite; 221 222 // Pretty permalinks 223 if ( $wp_rewrite->using_permalinks() ) { 224 $url = $wp_rewrite->root . bbp_get_search_slug(); 225 $url = home_url( user_trailingslashit( $url ) ); 226 227 // Unpretty permalinks 228 } else { 229 $search_terms = bbp_get_search_terms(); 230 $url = add_query_arg( array( 'bbp_search' => $search_terms ), home_url( '/' ) ); 231 } 232 233 return apply_filters( 'bbp_get_search_url', $url ); 234 } 235 236 237 /** 238 * Output the search terms 239 * 240 * @param string $search_terms Optional. Search terms 241 * @uses bbp_get_search_terms() To get the search terms 242 */ 243 function bbp_search_terms( $search_terms = '' ) { 244 echo bbp_get_search_terms( $search_terms ); 245 } 246 247 /** 248 * Get the search terms 249 * 250 * If search terms are supplied, those are used. Otherwise check the 251 * search rewrite id query var. 252 * 253 * @param string $search_terms Optional. Search terms 254 * @uses sanitize_title() To sanitize the search terms 255 * @uses get_query_var*( To get the search terms from query var 'bbp_search' 256 * @return bool|string Search terms on success, false on failure 257 */ 258 function bbp_get_search_terms( $search_terms = '' ) { 259 260 $search_terms = !empty( $search_terms ) ? sanitize_title( $search_terms ) : get_query_var( bbp_get_search_rewrite_id() ); 261 262 if ( !empty( $search_terms ) ) 263 return $search_terms; 264 265 return false; 266 } 267 268 /** 269 * Output the search result pagination count 270 * 271 * @uses bbp_get_search_pagination_count() To get the search result pagination count 272 */ 273 function bbp_search_pagination_count() { 274 echo bbp_get_search_pagination_count(); 275 } 276 277 /** 278 * Return the search results pagination count 279 * 280 * @uses bbp_number_format() To format the number value 281 * @uses apply_filters() Calls 'bbp_get_search_pagination_count' with the 282 * pagination count 283 * @return string Search pagination count 284 */ 285 function bbp_get_search_pagination_count() { 286 $bbp = bbpress(); 287 288 // Define local variable(s) 289 $retstr = ''; 290 291 // Set pagination values 292 $start_num = intval( ( $bbp->search_query->paged - 1 ) * $bbp->search_query->posts_per_page ) + 1; 293 $from_num = bbp_number_format( $start_num ); 294 $to_num = bbp_number_format( ( $start_num + ( $bbp->search_query->posts_per_page - 1 ) > $bbp->search_query->found_posts ) ? $bbp->search_query->found_posts : $start_num + ( $bbp->search_query->posts_per_page - 1 ) ); 295 $total_int = (int) $bbp->search_query->found_posts; 296 $total = bbp_number_format( $total_int ); 297 298 // Single page of results 299 if ( empty( $to_num ) ) { 300 $retstr = sprintf( _n( 'Viewing %1$s result', 'Viewing %1$s results', $total_int, 'bbpress' ), $total ); 301 302 // Several pages of results 303 } else { 304 $retstr = sprintf( _n( 'Viewing %2$s results (of %4$s total)', 'Viewing %1$s results - %2$s through %3$s (of %4$s total)', $bbp->search_query->post_count, 'bbpress' ), $bbp->search_query->post_count, $from_num, $to_num, $total ); 305 306 } 307 308 // Filter and return 309 return apply_filters( 'bbp_get_search_pagination_count', $retstr ); 310 } 311 312 /** 313 * Output search pagination links 314 * 315 * @uses bbp_get_search_pagination_links() To get the search pagination links 316 */ 317 function bbp_search_pagination_links() { 318 echo bbp_get_search_pagination_links(); 319 } 320 321 /** 322 * Return search pagination links 323 * 324 * @uses apply_filters() Calls 'bbp_get_search_pagination_links' with the 325 * pagination links 326 * @return string Search pagination links 327 */ 328 function bbp_get_search_pagination_links() { 329 $bbp = bbpress(); 330 331 if ( !isset( $bbp->search_query->pagination_links ) || empty( $bbp->search_query->pagination_links ) ) 332 return false; 333 334 return apply_filters( 'bbp_get_search_pagination_links', $bbp->search_query->pagination_links ); 335 } -
includes/topics/template-tags.php
365 365 * 366 366 * @param $topic_id Optional. Used to check emptiness 367 367 * @uses bbPress::topic_query::post::ID To get the topic id 368 * @uses bbp_is_topic() To check if the search result is a topic 368 369 * @uses bbp_is_single_topic() To check if it's a topic page 369 370 * @uses bbp_is_topic_edit() To check if it's a topic edit page 370 371 * @uses bbp_is_single_reply() To check if it it's a reply page … … 390 391 } elseif ( !empty( $bbp->topic_query->in_the_loop ) && isset( $bbp->topic_query->post->ID ) ) { 391 392 $bbp_topic_id = $bbp->topic_query->post->ID; 392 393 394 // Currently inside a search loop 395 } elseif ( !empty( $bbp->search_query->in_the_loop ) && isset( $bbp->search_query->post->ID ) && bbp_is_topic( $bbp->search_query->post->ID ) ) { 396 $bbp_topic_id = $bbp->search_query->post->ID; 397 393 398 // Currently viewing/editing a topic, likely alone 394 399 } elseif ( ( bbp_is_single_topic() || bbp_is_topic_edit() ) && !empty( $bbp->current_topic_id ) ) { 395 400 $bbp_topic_id = $bbp->current_topic_id; -
templates/default/bbpress/content-archive-forum.php
11 11 12 12 <div id="bbpress-forums"> 13 13 14 <div class="bbp-search-form"> 15 16 <?php bbp_get_template_part( 'form', 'search' ); ?> 17 18 </div> 19 14 20 <?php bbp_breadcrumb(); ?> 15 21 16 22 <?php do_action( 'bbp_template_before_forums_index' ); ?> -
templates/default/bbpress/content-search.php
1 <?php 2 3 /** 4 * Search Content Part 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div id="bbpress-forums"> 13 14 <?php bbp_breadcrumb(); ?> 15 16 <?php bbp_set_query_name( 'bbp_search' ); ?> 17 18 <?php do_action( 'bbp_template_before_search' ); ?> 19 20 <?php if ( bbp_has_search_results() ) : ?> 21 22 <?php bbp_get_template_part( 'pagination', 'search' ); ?> 23 24 <?php bbp_get_template_part( 'loop', 'search' ); ?> 25 26 <?php bbp_get_template_part( 'pagination', 'search' ); ?> 27 28 <?php else : ?> 29 30 <?php bbp_get_template_part( 'feedback', 'no-search' ); ?> 31 32 <?php endif; ?> 33 34 <?php bbp_get_template_part( 'form', 'search' ); ?> 35 36 <?php do_action( 'bbp_template_after_search_results' ); ?> 37 38 </div> 39 -
templates/default/bbpress/feedback-no-search.php
1 <?php 2 3 /** 4 * Oh bother! 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div class="bbp-template-notice"> 13 <p><?php _e( 'Oh bother! No search results were found here!', 'bbpress' ); ?></p> 14 </div> -
templates/default/bbpress/form-search.php
1 <?php 2 3 /** 4 * Search 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <form role="search" method="get" id="bbp-search" action="<?php bbp_search_url(); ?>"> 13 <div> 14 <label class="screen-reader-text" for="bbp_search"><?php _e( 'Search for:', 'bbpress' ); ?></label> 15 <input type="text" value="<?php echo esc_attr( bbp_get_search_terms() ); ?>" name="bbp_search" id="bbp_search" /> 16 <input type="submit" id="bbp_search_submit" value="<?php _e( 'Search Forums', 'bbpress' ); ?>" /> 17 </div> 18 </form> -
templates/default/bbpress/loop-search-forum.php
1 <?php 2 3 /** 4 * Search Loop - Single Forum 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div class="bbp-forum-header"> 13 14 <div class="bbp-meta"> 15 16 <span class="bbp-forum-post-date"><?php printf( __( 'Last updated %s', 'bbpress' ), bbp_get_forum_last_active_time() ); ?></span> 17 18 <a href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>" class="bbp-forum-permalink">#<?php bbp_forum_id(); ?></a> 19 20 </div><!-- .bbp-meta --> 21 22 <div class="bbp-forum-title"> 23 24 <?php do_action( 'bbp_theme_before_forum_title' ); ?> 25 26 <h3><?php _e( 'Forum: ', 'bbpress' ); ?><a href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>"><?php bbp_forum_title(); ?></a></h3> 27 28 <?php do_action( 'bbp_theme_after_forum_title' ); ?> 29 30 </div><!-- .bbp-forum-title"> 31 32 </div><!-- .bbp-forum-header --> 33 34 <div id="post-<?php bbp_forum_id(); ?>" <?php bbp_forum_class(); ?>> 35 36 <div class="bbp-forum-content"> 37 38 <?php do_action( 'bbp_theme_before_forum_content' ); ?> 39 40 <?php the_excerpt(); ?> 41 42 <?php do_action( 'bbp_theme_after_forum_content' ); ?> 43 44 </div><!-- .bbp-forum-content --> 45 46 </div><!-- #post-<?php bbp_forum_id(); ?> --> -
templates/default/bbpress/loop-search-reply.php
1 <?php 2 3 /** 4 * Search Loop - Single Reply 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div class="bbp-reply-header"> 13 14 <div class="bbp-meta"> 15 16 <span class="bbp-reply-post-date"><?php bbp_reply_post_date(); ?></span> 17 18 <a href="<?php bbp_reply_url(); ?>" title="<?php bbp_reply_title(); ?>" class="bbp-reply-permalink">#<?php bbp_reply_id(); ?></a> 19 20 <?php do_action( 'bbp_theme_before_reply_admin_links' ); ?> 21 22 <?php bbp_reply_admin_links(); ?> 23 24 <?php do_action( 'bbp_theme_after_reply_admin_links' ); ?> 25 26 </div><!-- .bbp-meta --> 27 28 <div class="bbp-reply-title"> 29 30 <h3><?php _e( 'In reply to: ', 'bbpress' ); ?> 31 <a class="bbp-topic-permalink" href="<?php bbp_topic_permalink( bbp_get_reply_topic_id() ); ?>" title="<?php bbp_topic_title( bbp_get_reply_topic_id() ); ?>"><?php bbp_topic_title( bbp_get_reply_topic_id() ); ?></a></h3> 32 33 </div><!-- .bbp-reply-title --> 34 35 </div><!-- .bbp-reply-header --> 36 37 <div id="post-<?php bbp_reply_id(); ?>" <?php bbp_reply_class(); ?>> 38 39 <div class="bbp-reply-author"> 40 41 <?php do_action( 'bbp_theme_before_reply_author_details' ); ?> 42 43 <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?> 44 45 <?php if ( is_super_admin() ) : ?> 46 47 <?php do_action( 'bbp_theme_before_reply_author_admin_details' ); ?> 48 49 <div class="bbp-reply-ip"><?php bbp_author_ip( bbp_get_reply_id() ); ?></div> 50 51 <?php do_action( 'bbp_theme_after_reply_author_admin_details' ); ?> 52 53 <?php endif; ?> 54 55 <?php do_action( 'bbp_theme_after_reply_author_details' ); ?> 56 57 </div><!-- .bbp-reply-author --> 58 59 <div class="bbp-reply-content"> 60 61 <?php do_action( 'bbp_theme_before_reply_content' ); ?> 62 63 <?php bbp_reply_content(); ?> 64 65 <?php do_action( 'bbp_theme_after_reply_content' ); ?> 66 67 </div><!-- .bbp-reply-content --> 68 69 </div><!-- #post-<?php bbp_reply_id(); ?> --> 70 -
templates/default/bbpress/loop-search-topic.php
1 <?php 2 3 /** 4 * Search Loop - Single Topic 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div class="bbp-topic-header"> 13 14 <div class="bbp-meta"> 15 16 <span class="bbp-topic-post-date"><?php bbp_topic_post_date( bbp_get_topic_id() ); ?></span> 17 18 <a href="<?php bbp_topic_permalink(); ?>" title="<?php bbp_topic_title(); ?>" class="bbp-topic-permalink">#<?php bbp_topic_id(); ?></a> 19 20 <?php do_action( 'bbp_theme_before_topic_admin_links' ); ?> 21 22 <?php bbp_topic_admin_links( bbp_get_topic_id() ); ?> 23 24 <?php do_action( 'bbp_theme_after_topic_admin_links' ); ?> 25 26 </div><!-- .bbp-meta --> 27 28 <div class="bbp-topic-title"> 29 30 <?php do_action( 'bbp_theme_before_topic_title' ); ?> 31 32 <h3><?php _e( 'Topic: ', 'bbpress' ); ?> 33 <a href="<?php bbp_topic_permalink(); ?>" title="<?php bbp_topic_title(); ?>"><?php bbp_topic_title(); ?></a></h3> 34 35 <div class="bbp-topic-title-meta"> 36 37 <?php if ( function_exists( 'bbp_is_forum_group_forum' ) && bbp_is_forum_group_forum( bbp_get_topic_forum_id() ) ) : ?> 38 39 <?php _e( 'in group forum ', 'bbpress' ); ?> 40 41 <?php else : ?> 42 43 <?php _e( 'in forum ', 'bbpress' ); ?> 44 45 <?php endif; ?> 46 47 <a href="<?php bbp_forum_permalink( bbp_get_topic_forum_id() ); ?>" title="<?php bbp_forum_title( bbp_get_topic_forum_id() ); ?>"><?php bbp_forum_title( bbp_get_topic_forum_id() ); ?></a> 48 49 </div><!-- .bbp-topic-title-meta --> 50 51 <?php do_action( 'bbp_theme_after_topic_title' ); ?> 52 53 </div><!-- .bbp-topic-title --> 54 55 </div><!-- .bbp-topic-header --> 56 57 <div id="post-<?php bbp_topic_id(); ?>" <?php bbp_topic_class(); ?>> 58 59 <div class="bbp-topic-author"> 60 61 <?php do_action( 'bbp_theme_before_topic_author_details' ); ?> 62 63 <?php bbp_topic_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?> 64 65 <?php if ( is_super_admin() ) : ?> 66 67 <?php do_action( 'bbp_theme_before_topic_author_admin_details' ); ?> 68 69 <div class="bbp-reply-ip"><?php bbp_author_ip( bbp_get_topic_id() ); ?></div> 70 71 <?php do_action( 'bbp_theme_after_topic_author_admin_details' ); ?> 72 73 <?php endif; ?> 74 75 <?php do_action( 'bbp_theme_after_topic_author_details' ); ?> 76 77 </div><!-- .bbp-topic-author --> 78 79 <div class="bbp-topic-content"> 80 81 <?php do_action( 'bbp_theme_before_topic_content' ); ?> 82 83 <?php bbp_topic_content(); ?> 84 85 <?php do_action( 'bbp_theme_after_topic_content' ); ?> 86 87 </div><!-- .bbp-topic-content --> 88 89 </div><!-- #post-<?php bbp_topic_id(); ?> --> -
templates/default/bbpress/loop-search.php
1 <?php 2 3 /** 4 * Search Loop 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <?php do_action( 'bbp_template_before_search_results_loop' ); ?> 13 14 <ul id="bbp-search-results" class="forums bbp-search-results"> 15 16 <li class="bbp-header"> 17 18 <div class="bbp-search-author"><?php _e( 'Author', 'bbpress' ); ?></div><!-- .bbp-reply-author --> 19 20 <div class="bbp-search-content"> 21 22 <?php _e( 'Search Results', 'bbpress' ); ?> 23 24 </div><!-- .bbp-search-content --> 25 26 </li><!-- .bbp-header --> 27 28 <li class="bbp-body"> 29 30 <?php while ( bbp_search_results() ) : bbp_the_search_result(); ?> 31 32 <?php bbp_get_template_part( 'loop', 'search-' . get_post_type() ); ?> 33 34 <?php endwhile; ?> 35 36 </li><!-- .bbp-body --> 37 38 <li class="bbp-footer"> 39 40 <div class="bbp-search-author"><?php _e( 'Author', 'bbpress' ); ?></div> 41 42 <div class="bbp-search-content"> 43 44 <?php _e( 'Search Results', 'bbpress' ); ?> 45 46 </div><!-- .bbp-search-content --> 47 48 </li><!-- .bbp-footer --> 49 50 </ul><!-- #bbp-search-results --> 51 52 <?php do_action( 'bbp_template_after_search_results_loop' ); ?> 53 No newline at end of file -
templates/default/bbpress/pagination-search.php
1 <?php 2 3 /** 4 * Pagination for pages of search results 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <?php do_action( 'bbp_template_before_pagination_loop' ); ?> 13 14 <div class="bbp-pagination"> 15 <div class="bbp-pagination-count"> 16 17 <?php bbp_search_pagination_count(); ?> 18 19 </div> 20 21 <div class="bbp-pagination-links"> 22 23 <?php bbp_search_pagination_links(); ?> 24 25 </div> 26 </div> 27 28 <?php do_action( 'bbp_template_after_pagination_loop' ); ?> -
templates/default/css/bbpress.css
34 34 height: auto; 35 35 } 36 36 37 #bbpress-forums div.bbp-forum-header, 37 38 #bbpress-forums div.bbp-topic-header, 38 39 #bbpress-forums div.bbp-reply-header { 39 40 background-color: #f4f4f4; … … 67 68 #bbpress-forums ul.bbp-lead-topic, 68 69 #bbpress-forums ul.bbp-topics, 69 70 #bbpress-forums ul.bbp-forums, 70 #bbpress-forums ul.bbp-replies { 71 #bbpress-forums ul.bbp-replies, 72 #bbpress-forums ul.bbp-search-results { 71 73 font-size: 12px; 72 74 overflow: hidden; 73 75 border: 1px solid #eee; … … 166 168 float: right; 167 169 } 168 170 171 #bbpress-forums div.bbp-forum-title h3, 172 #bbpress-forums div.bbp-topic-title h3, 173 #bbpress-forums div.bbp-reply-title h3 { 174 line-height: 1em; 175 margin: 8px 0; 176 } 177 178 #bbpress-forums div.bbp-search-author, 179 #bbpress-forums div.bbp-forum-author, 169 180 #bbpress-forums div.bbp-topic-author, 170 181 #bbpress-forums div.bbp-reply-author { 171 182 float: left; … … 173 184 width: 115px; 174 185 } 175 186 187 #bbpress-forums div.bbp-forum-author img.avatar, 176 188 #bbpress-forums div.bbp-topic-author img.avatar, 177 189 #bbpress-forums div.bbp-reply-author img.avatar { 178 190 border: none; … … 182 194 float: none; 183 195 } 184 196 197 #bbpress-forums div.bbp-forum-author a.bbp-author-name, 185 198 #bbpress-forums div.bbp-topic-author a.bbp-author-name, 186 199 #bbpress-forums div.bbp-reply-author a.bbp-author-name { 187 200 margin: 0 12px; 188 201 word-break: break-word; 189 202 } 190 203 204 #bbpress-forums div.bbp-forum-author .bbp-author-role, 191 205 #bbpress-forums div.bbp-topic-author .bbp-author-role, 192 206 #bbpress-forums div.bbp-reply-author .bbp-author-role { 193 207 font-size: 11px; 194 208 font-style: italic; 195 209 } 196 210 211 #bbpress-forums div.bbp-forum-content, 197 212 #bbpress-forums div.bbp-topic-content, 198 213 #bbpress-forums div.bbp-reply-content { 199 214 margin-left: 140px; … … 201 216 text-align: left; 202 217 } 203 218 219 #bbpress-forums li.bbp-header .bbp-forum-author, 220 #bbpress-forums li.bbp-footer .bbp-forum-author, 204 221 #bbpress-forums li.bbp-header .bbp-topic-author, 205 222 #bbpress-forums li.bbp-footer .bbp-topic-author, 206 223 #bbpress-forums li.bbp-header .bbp-reply-author, … … 211 228 width: 120px; 212 229 } 213 230 231 #bbpress-forums li.bbp-header .bbp-forum-content, 232 #bbpress-forums li.bbp-footer .bbp-forum-content, 214 233 #bbpress-forums li.bbp-header .bbp-topic-content, 215 234 #bbpress-forums li.bbp-footer .bbp-topic-content, 216 235 #bbpress-forums li.bbp-header .bbp-reply-content, … … 220 239 text-align: left; 221 240 } 222 241 242 div.bbp-forum-header, 223 243 div.bbp-topic-header, 224 244 div.bbp-reply-header, 225 245 li.bbp-body div.hentry { … … 228 248 padding: 8px; 229 249 } 230 250 251 div.bbp-forum-header, 231 252 div.bbp-topic-header, 232 253 div.bbp-reply-header { 233 254 border-top: 1px solid #ddd; … … 262 283 float: right; 263 284 } 264 285 286 /* =Search 287 -------------------------------------------------------------- */ 288 289 div.bbp-search-form { 290 float: right; 291 } 292 293 265 294 /* =Admin Links 266 295 -------------------------------------------------------------- */ 267 296 … … 287 316 width: 50%; 288 317 } 289 318 319 .bbp-forum-header a.bbp-forum-permalink, 290 320 .bbp-topic-header a.bbp-topic-permalink, 291 321 .bbp-reply-header a.bbp-reply-permalink { 292 322 float: right;