WordPress.org

Ready to get started?Download WordPress

Forums

WP Resume
[resolved] WP-Resume and WPML integration (1 post)

  1. Richard Vencu
    Member
    Posted 3 years ago #

    Hi, if anyone is interested in translating the resume with WPML (or qTranslate perhaps) here is some needed coding:

    1. Select translation for the resume custom post type as well as for the sections and organization custom taxonomies
    2. In order to properly display the resume in the translated language make sure it first gets displayed correctly in the default (admin) language
    3. Then change this function as listed below. Changes to the function are adding the 'taxonomy' argument for get_terms (so the sections will return filtered in the current language by WPML) and use the default language order for all the translated languages - in my case this language is 'ro' but please change with your language code.

    function wp_resume_get_sections( $hide_empty = true ) {
    
    	//init array
    	$output = array();
    
    	//get all sections ordered by term_id (order added)
    	$sections = get_terms( 'wp_resume_section', array( 'hide_empty' => $hide_empty,'taxonomy' => 'wp_resume_section' ) );
    
    	//get the plugin options array to pulll the user-specified order
    	$options = wp_resume_get_options();
    
    	//pull out the order array (form: term_id => order)
    	$section_order = $options[ 'order' ];
    
    	//Loop through each section
    	foreach( $sections as $ID => $section ) {
    
    		//if the term is in our order array
    		if ( is_array($section_order) && array_key_exists( icl_object_id($section->term_id,'wp_resume_section',true,'ro'), $section_order ) ) { 
    
    			//push the term object into the output array keyed to it's order
    			$output[ $section_order[icl_object_id($section->term_id,'wp_resume_section',true,'ro')] ] = $section;
    
    			//pull the term out of the original array
    			unset($sections[$ID]);
    
    		}
    	}
    
    	//for those terms that we did not have a user-specified order, stick them at the end of the output array
    	foreach($sections as $section) $output[] = $section;
    
    	//sort by key
    	ksort($output);
    
    	//return the new array keyed to order
    	return $output;
    
    }

    http://wordpress.org/extend/plugins/wp-resume/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags