Reply To: costum design for a button and result page

Home Forums Product Support Forums Ajax Search Pro for WordPress Support costum design for a button and result page Reply To: costum design for a button and result page

#3942
Ernest Marcinko
Ernest Marcinko
Keymaster

Hi!

The input for the custom URL was built in because some customers had different (customized) url for the search results and they needed to adjust the redirection from the Ajax Search Pro.

The ‘Override the default WordPress search results page’ overrides actually the results on the default search results page, not the page location or the URL or the layout. So you should see similar result items to the ajax search pro results. The page (layout or URL) cannot be overriden by a plugin unfortunately.

If you want to change the url of the results page, then you need to either create page redirect filter in the theme functions.php, or to create a .htaccess rule. This method will bypass the required query variables back to the default search page. Unfortunately it’s not possible to do this with a plugin, that’s why ajax search pro can’t manage this part.
I think the article I linked covers both methods: http://wpengineer.com/2258/change-the-search-url-of-wordpress/

After the redirection is set properly, then you need to change the custom search URL on the ajax search pro settings to match the redirection pattern.

I’m sorry if it’s a bit confusing, permalink redirects are extremely hard to understand, and I’m not the best when it comes to explaining 😀

Anyways, I can’t really help with the redirection issue as it’s not related to the search, but based on that article I’ve modified that code there, which should work on your server. So, try to put this to your themes functions.php file:

function asp_change_search_url_rewrite() {
	if ( is_search() && ! empty( $_GET['s'] ) ) {
		wp_redirect( home_url( "/פרסונות/" ) . urlencode( get_query_var( 's' ) ) );
		exit();
	}	
}
add_action( 'template_redirect', 'asp_change_search_url_rewrite' );

Okay. Now, after putting this code the urls like: http://www.persona.org.il/פרסונות/phrase
should start showing some search results, as wordpress now knows that the “/פרסונות/” permalink is triggering a search.

Now try to change the ‘Redirect to url?’ setting on the Ajax Search Pro settings to this:
פרסונות/{phrase}

You might need to turn off the ‘Override the default WordPress search results page’ in order to make it work, I’m not sure about this.

I’m hoping that his will help you.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)