• Hello,

    I created a site with a custom theme and a custom post type called “Members” (www.sauganashchamber.org). The members are categorized by their business for example, automotive repair, banks, landscapers, etc. The Search Everything plugin searches the_content() beautifully but does not work with the category name, although I have it specified as such in the settings. If the search word appears in the name of the business it works great, as long as it is “one” word. I have two questions:

    1. Is it possible for me to search categories within a custom post type?

    2. Can I change a setting that would include “two word” queries such as “Automotive Repair”?

    I would appreciate any help with this. Thanks in advance.

    https://wordpress.org/plugins/search-everything/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey, thanks for reaching out, I’ll do my best to help you out!

    Well, that “Members” custom post type is a bit different than the ones we usually met so far. But to answer your questions:

    1.) we searched for keywords such as “medical” & “regulatory” and our plugin returned with some results from that category, although none of them was found in the title or the content of the results.

    2.) This should work as well, to be honest, although we don’t have a setting for it (it should be on by default). Just to be sure, you are running the latest version of our plugin, no?

    I would like to kindly ask you if you could wait until Monday, when a colleague of mine returns to the offices and we’d like to check it ourselves what can be done with those issues you’re currently experiencing, since I believe we were once already dealing with them in the past.

    But please do let me know if you have any more questions or if I missed anything, since I’d gladly help wherever I can! Take care & I’m looking forward to your reply!

    Best,
    Silvo

    Thread Starter seifs4

    (@seifs4)

    Hello,

    The Search Everything plugin is working great when I search for a “one word” term. Is there any way that I can adjust the code to accept “two word” queries such as “web design” or “automotive repair”?

    I would appreciate any help with this, thanks!

    seifs4

    Hey, thanks for getting back to me, appreciate it, although I’m sorry I haven’t responded any sooner! Sorry!

    As for that “two-word-problem” — would you please go to your WordPress’s Dashboard under the ‘Plugins’-‘Editor’ tab, and select our plugin in the top right corner, find the search-everything.php file, select it and then find the following function:

    function se_build_search_tag()

    Replace the $searchand = ‘ AND ‘; with the $searchand = ‘ OR ‘;

    function se_build_search_tag() {
    		global $wpdb;
    		$vars = $this->query_instance->query_vars;
    
    		$s = $vars['s'];
    		$search_terms = $this->se_get_search_terms();
    		$exact = isset( $vars['exact'] ) ? $vars['exact'] : '';
    		$search = '';
    
    		if ( !empty( $search_terms ) ) {
    			// Building search query
    			$n = ( $exact ) ? '' : '%';
    			$searchand = '';
    			foreach ( $search_terms as $term ) {
    				$term = addslashes_gpc( $term );
    				if ( $this->wp_ver23 ) {
    					$search .= "{$searchand}(tter.name LIKE '{$n}{$term}{$n}')";
    				}
    				$searchand = ' OR '; <------HERE!!!!
    			}
    			$sentence_term = esc_sql( $s );
    			if ( count( $search_terms ) > 1 && $search_terms[0] != $sentence_term ) {
    				if ( $this->wp_ver23 ) {
    					$search = "($search) OR (tter.name LIKE '{$n}{$sentence_term}{$n}')";
    				}
    			}
    			if ( !empty( $search ) )
    				$search = " OR ({$search}) ";
    		}
    		$this->se_log( "tag where: ".$search );
    		return $search;
    	}

    Check the screenshot for easier navigation.

    Let me know how it turns out or if you have any more questions, I’ll do my best to get back to you much sooner this time round!

    Take care & have a nice day!

    Best,
    Silvo

    Thread Starter seifs4

    (@seifs4)

    I appreciate you getting back to me but the change in the code hasn’t seemed to help. I tried to search for “web design” and “automotive repair”, both of which should produce results and there were no results found.

    I left the change in place in case you wanted to check it out yourself @ http://www.sauganashchamber.org.

    Any other ideas would be greatly appreciated.

    Thanks again for getting back to me.
    seifs4

    Hey, thanks for the feedback, although I’m sad to hear it didn’t work! But I’m sure we’ll be able to tackle it somehow!

    The thing is, at this point we’re not so sure anymore what could be the real culprit of your problems, but we suspect it might have something to do with the theme you are currently using, which is why we would love to take a closer look at it, if possible.

    Is there a chance you could send us your WP Dashboard’s credentials, so that we could investigate further? We can completely understand if you’re not comfortable with sharing this with us, but I’m afraid this might be the only viable solution for us right now, since we cannot access that broken window in any other way. It also goes without saying that your privacy is to our upmost concern, after which we will take all the extra precaution possible.

    Also — rest assured that none of your settings will be changed or modified, nor will anything be edited or published. All we want is to collect some data.

    Here’s my email, if you decide to share your trust with us: support[at]zemanta[dot]com

    Let us know what you think and we’ll do our best to help you out! I’m looking forward to your reply!

    Take care & have a nice day!

    Best,
    Silvo

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Not searching categories within custom post type’ is closed to new replies.