Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I display search results differently?


  • Robert.S
    Participant

    @roberts-1

    Hi there – I’ve googled; searched plugins and read a fair bit here. My question is about changing the way search results for BBPress display.

    I’m using the Avada theme 3.8.3
    Wordpress 4.2.4
    BBPress 2.5.8

    There are a couple of issues – only in the visual appearance of BBPress search results, and I need some tips as to how to fix it!

    • Search results are not well distinguished (compared to our previous ExpressionEngine forum, where admittedly, the forum post content was not shown, but it easy to see the list of topics and results). A mix of “Topics” and “Replies To” are shown
    • Search results may include several posts from the one topic, but these are not collated (they are displayed in order of recency, and usually appear in between the other search results)
    • Search results with long forum posts take up too much page realestate

    Please see these two screenshots that illustrate the difference:

    https://www.dropbox.com/s/04ndkdsjlpa5k8j/avada-forum-search.jpg?dl=0Avada BBPress Search Results
    ExpressionEngine Search Results

    Clearly the search results are very thorough, and I’m looking for help to represent them more efficiently.

    • What template would I look for?
    • How can I change the loop so that the results are more like our old forum?

    Thanks in advance – feel free to point me to any plugins I may have missed.

    Robert

Viewing 5 replies - 1 through 5 (of 5 total)

  • Robert.S
    Participant

    @roberts-1

    Ooopsy. Don’t know what went wrong with those image urls. Here they are again:

    Avada BBPress Search Results: https://www.dropbox.com/s/04ndkdsjlpa5k8j/avada-forum-search.jpg?dl=0

    ExpressionEngine old forum Search Results: https://www.dropbox.com/s/u31awcckz4261oi/Expression-Engine-forum-search.jpg?dl=0


    Robkk
    Moderator

    @robkk

    Sorry for the late reply, I just approved your topic.

    The files you may want to edit are.

    loop-search-forum.php
    loop-search-topic.php
    loop-search-reply.php
    loop-search.php

    These templates are in the bbPress plugin, and you can copy them over into your child theme so that customizations won’t be lost after a bbPress plugin update.

    I am not sure if expression engine only searches for topics, but I cannot find how to exclude certain posts from the forum search.

    You can also use some search enhancing plugins if you want. There are some plugins that search custom post types like Search Everything. I have also seen users hook up Google Custom Search too.


    Robert.S
    Participant

    @roberts-1

    Thanks so much Robkk.

    I’ll take a look at those files, and see if any plugins might do the trick.

    I am using some custom code I found *somewhere* (!! maybe here haha??) to include Forum results in general WordPress Search results, which works well enough, but of course this is from a site-search, not the BBPress search function.

    Here it is in case anyone else stumbles across this thread and wants to extend WordPress searches to include Forum results (without adding a plugin):

    /**
     * Include bbPress 'topic' custom post type in WordPress' search results */
    
    function ntwb_bbp_topic_cpt_search( $topic_search ) {
    	$topic_search['exclude_from_search'] = false;
    	return $topic_search;
    }
    add_filter( 'bbp_register_topic_post_type', 'ntwb_bbp_topic_cpt_search' );
    
    /**
     * Include bbPress 'forum' custom post type in WordPress' search results */
    
    function ntwb_bbp_forum_cpt_search( $forum_search ) {
    	$forum_search['exclude_from_search'] = false;
    	return $forum_search;
    }
    add_filter( 'bbp_register_forum_post_type', 'ntwb_bbp_forum_cpt_search' );
    
    /**
     * Include bbPress 'reply' custom post type in WordPress' search results  */
    
    function ntwb_bbp_reply_cpt_search( $reply_search ) {
    	$reply_search['exclude_from_search'] = false;
    	return $reply_search;
    }
    add_filter( 'bbp_register_reply_post_type', 'ntwb_bbp_reply_cpt_search' );

    1kan5
    Participant

    @1kan5

    Thanks you Robert.S

    Where do i have to put this code ?


    Robkk
    Moderator

    @robkk

    @1kan5

    Add it to your child theme’s function.php file or in a functionality plugin.


    @roberts-1

    To get the Expression Engine layout you would need to base most of the loop-search files like loop-search-topic.php off of loop-single-topic.php to get the result you are looking for.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar