Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Jose David Moliner
    #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

    Jose David Moliner
    #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)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.