Translate form search with WP Globus / qTranslate X

Forums › Forums › Search & Filter Pro › Translate form search with WP Globus / qTranslate X

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #29038

    Hi,

    I’m using a multilanguage plugin called WP Globus, it works like qTranslate, store all languages alternatives for each post in the same post. WP Globus insert all texts using special language delimiters: {:en}Hallo{:}{:es}Hola{:} , with qTranslate X [:en]Hallo[:][:es]Hola[:]

    I use this filter to show in each language:

    <?php echo apply_filters( ‘the_title’, {:en}Hallo{:}{:es}Hola{:} ); ?>

    How could I use this with Search and Filter?

    Ross Moderator
    #29302

    Hey Jose

    I’m afraid I have no idea how that plugin works or how to set that up.

    I’ll try to take a look when I find some time but really busy at the moment.

    We only officially support WPML at the moment (and are almost there with Polylang), although users’ have reported qTranslate working also.

    Thanks

    Anonymous
    #29410

    Hey Ross,

    With colaboration with WP Globus Team I attach this function to get run WP Globus and Search And Filter:

    add_filter( 'get_post_metadata', 'wpglobus_metadata__filter', 10, 4 );
    function wpglobus_metadata__filter( $null, $object_id, $meta_key, $single ) {
    	if (!is_admin()) {
    		if ( '_search-filter-fields' == $meta_key ) {
    
    			$meta_type = 'post';
    			$meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
    
    			if ( !$meta_cache ) {
    				$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
    				$meta_cache = $meta_cache[$object_id];
    			}
    
    			if ( ! $meta_key ) {
    				return $meta_cache;
    			}
    
    			if ( isset($meta_cache[$meta_key]) ) {
    
    				if ( $single ) {
    					$value = maybe_unserialize( $meta_cache[$meta_key][0] );						
    					for ($i = 0 ; $i<count($value) ; $i++) {
    						$value[$i]['heading'] = WPGLobus_Core::text_filter($value[$i]['heading'], WPGlobus::Config()->language );
    						$value[$i]['all_items_label'] = WPGLobus_Core::text_filter($value[$i]['all_items_label'], WPGlobus::Config()->language );
    						if (!empty($value[$i]['meta_options'][0]['option_label']))
    							$value[$i]['meta_options'][0]['option_label'] = WPGLobus_Core::text_filter($value[$i]['meta_options'][0]['option_label'], WPGlobus::Config()->language );
    					}
    
    					return array( 0 => $value );
    				} 
    				else {
    					return array_map('maybe_unserialize', $meta_cache[$meta_key]);
    				}
    			}
    		}
    
    		return null;
    	}
    }

    How about?

    Ross Moderator
    #29412

    Fantastic!

    Thanks for the info 🙂

Viewing 4 posts – 1 through 4 (of 4 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.