WordPress.org

Ready to get started?Download WordPress

Forums

bbPress Search Widget
[resolved] Why drop-down? (4 posts)

  1. Eric Andrew Lewis
    Member
    Posted 2 years ago #

    I'm a little surprised there is a dropdown in the widget, and can't imagine a user actively wanting to search forum titles and descs instead of every post type throughout the forum.

    I'm glad this plugin exists though, I'm patching up my own to take out the dropdown.

    I've taken out the dropdown, and replaced it with this:

    $form .= '<input type="hidden" value="forums" name="post_type">';

    And to search all three post types, modify query vars as such:

    add_action('parse_query', 'maybe_modify_query_for_forums_search');
    
    function maybe_modify_query_for_forums_search($query) {
    	if( !$_GET['s'] && !$query->query_vars['post_type'] == "forums")
    		return;
    	$query->query_vars['post_type'] = array('topic', 'forum', 'reply');
    	$query->query['post_type'] = array('topic', 'forum', 'reply');
    }
  2. Eric Andrew Lewis
    Member
    Posted 2 years ago #

    Note: you should actually use "forum" instead of "forums" for the desired result, depending on the post type slug you use.

  3. daveshine (David Decker)
    Member
    Plugin Author

    Posted 2 years ago #

    Hi there!

    Thanx for your feedback, I will look into the issues soon as there is already some updated planned for the plugin.

    The main reason for the dropdown was to better refine search results - but it may not be wanted in all cases. So your solution is the other alternative. Based on user feedback it's 50/50 for all combined or keeping the dropdown.

    I'll try your patch and maybe include it by default in the future!

    Thanx again, Dave :)

  4. daveshine (David Decker)
    Member
    Plugin Author

    Posted 2 years ago #

    Hi there, I just updated the plugin to version 1.1 and hopefully it works for you now better. We changed/improved a few things, for example the drop-down is gone, now automatically only searches in topics/replies. Hope you like it.

    Thanx, Dave :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic