WordPress.org

Forums

Nice Search
WPML compatibility (1 post)

  1. Daniele Raimondi
    Member
    Posted 1 year ago #

    Don't know if the author is still monitoring this support page, however, for all of you out there using WPML plugin for multilanguage, I've added just two simple lines to make this plugin WPML compatible. So here is the modded code for function cws_nice_search_redirect:

    function cws_nice_search_redirect() {
    	global $wp_rewrite;
    	if ( !isset( $wp_rewrite ) || !is_object( $wp_rewrite ) || !$wp_rewrite->using_permalinks() )
    		return;
    
    	$search_base = $wp_rewrite->search_base;
    	if ( is_search() && !is_admin() && strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) === false ) {
    		if ( function_exists('icl_get_home_url') ){
    			wp_redirect( icl_get_home_url()."{$search_base}/" . urlencode( get_query_var( 's' ) ) ) ;
    		}else{
    			wp_redirect( home_url("/{$search_base}/" . urlencode( get_query_var( 's' ) ) ) );
    		}
    		exit();
    	}
    }

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Nice Search
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by Daniele Raimondi
  • This topic is not resolved
  • WordPress version: 3.8.3