badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

WPML translations

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #40166
    Emilio José
    Participant

    How can I translate Home Page Primary Slogan and Home Page Secondary Slogan, for example?

    Kind regards.

    #40175
    Emilio José
    Participant
    
    /**
     * Añade soporte para WPML
     */
    function apg_wpml() {	
    	global $array_of_default_settings;
    	
    	$options = wp_parse_args( get_option( 'interface_theme_options', array() ), interface_get_option_defaults() );
    	
    	if ( function_exists( 'icl_object_id' ) ) { //Registramos los textos en WPML
    		do_action( 'wpml_register_single_string', 'apg_interface', 'home_slogan1', $options['home_slogan1'] );
    		do_action( 'wpml_register_single_string', 'apg_interface', 'home_slogan2', $options['home_slogan2'] );
    		do_action( 'wpml_register_single_string', 'apg_interface', 'footer_code', $options['footer_code'] );
    	}
    }
    add_action( 'init', 'apg_wpml', 15 );
    
    if ( ! function_exists( 'interface_home_slogan' ) ) :
    
    /**
     * Display Home Slogan.
     *
     * Function that enable/disable the home slogan1 and home slogan2.
     */
    function interface_home_slogan() {	
    	global $array_of_default_settings;
    	
     	$options = wp_parse_args( get_option( 'interface_theme_options', array() ), interface_get_option_defaults() );
    	
    	$home_slogan1	= $options['home_slogan1'];
    	$home_slogan2	= $options['home_slogan2'];
    	if ( function_exists( 'icl_object_id' ) ) { //Versión 3.2 o superior
    		$home_slogan1	= apply_filters( 'wpml_translate_single_string', $options['home_slogan1'], 'apg_interface', 'home_slogan1' );
    		$home_slogan2	= apply_filters( 'wpml_translate_single_string', $options['home_slogan2'], 'apg_interface', 'home_slogan2' );
    	}
    	
    	$interface_home_slogan = '';
    	if( !empty( $home_slogan1 ) || !empty( $home_slogan2 ) ) {
          
    		if ( 1 != $options[ 'disable_slogan' ] ) {
    			$interface_home_slogan .= '<section class="slogan-wrap"><div class="container"><div class="slogan">';
    			if ( !empty( $home_slogan1 ) ) {
    				$interface_home_slogan .= esc_html( $home_slogan1 );
    			}
    			if ( !empty( $home_slogan2 ) ) {
    				$interface_home_slogan .= '<span>'.esc_html( $home_slogan2 ).'</span>';
    			}
    			$interface_home_slogan .= '</div><!-- .slogan -->';
    			$interface_home_slogan .= '</div><!-- .container --></section><!-- .slogan-wrap -->';
    		}
    		
    	}	
    	echo $interface_home_slogan;
    }
    endif;
    
    /**
     * function to show the footer info, copyright information
     */
    function apg_interface_footer_info() {         
    	global $array_of_default_settings;
    	
     	$options = wp_parse_args( get_option( 'interface_theme_options', array() ), interface_get_option_defaults() );
    
    	$footer_code	= $options['footer_code'];
    	if ( function_exists( 'icl_object_id' ) ) { //Versión 3.2 o superior
    		$footer_code	= apply_filters( 'wpml_translate_single_string', $options['footer_code'], 'apg_interface', 'footer_code' );
    	}
    
        $interface_footer_info = '<div class="copyright">' . $footer_code . '</div><!-- .copyright -->';
       	echo do_shortcode( $interface_footer_info );
    }
    
    function sobrescribiendo_ganchos() {
    	remove_filter( 'interface_footer', 'interface_footer_info', 30 );
    	add_filter( 'interface_footer', 'apg_interface_footer_info', 30 );
    }
    add_action( 'after_setup_theme', 'sobrescribiendo_ganchos' );
    
    #40176

    HI Emilio José,

    As our theme is not compatible with WPML translations. We are a bit busy working on another projects. As it needs code customization. You need to hire a developer to fix it.

    Before making any changes in code first you create a child theme so that while updating to new version your customization code will not be lost.

    Thank you!

    #40180
    Emilio José
    Participant

    This code was added to functions.php file on my child theme.

    Kind regards.

    #40181

    Hi Emilio José,

    You need to create wpml.xml file inside the root of the theme. Although we have not tested our theme with WPML. For this you need to hire a developer.

    Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.