Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #29640

    Hi!

    I have just installed the WPML, My site default language is greek, and now I want to add the english translation. Please inform if there is a way to copy to my seccond language (english) all of the templates I made with template builder, or do I have to make them again for english language.

    Regards,

    Penelope

    #141175

    Also please inform me how I can translate the content of some meta information field of a portfolio item. One meta information in my portfolio entries is an address field, so it need to be translate. But when I save the translated entry it keeps rolling back to greek.

    Thnks

    Penelope

    #141176

    Hi,

    1) No, you must create the templates for each language and you can’t re-use the templates from another language.

    2) Please create me a wordpress admin account and send me the login data to: (Email address hidden if logged out) – I’ll look into it and check why the post meta values are not translated.

    #161602

    Hi,
    I fixed it on your website. It seems to be a bug in the theme framework and I’ll notify Kriesi. I had to replace following code in /wp-content/themes/flagship/includes/admin/register-admin-metabox.php

    
    
    /*dynamic portfolio meta fields*/
    $portfolio_metas = avia_get_option('portfolio-meta', array(array('meta'=>'Skills Needed'), array('meta'=>'Client'), array('meta'=>'Project URL')));
    
    $counter = 0;
    foreach($portfolio_metas as $p_meta)
    {
    	if(!empty($p_meta['meta']))
    	{
    
    		$counter ++;
    		$elements[] = array(	
    					"name" 	=> $p_meta['meta'],
    					"desc" 	=> "" ,
    					"id" 	=> "portfolio-meta-$counter",
    					"type" 	=> "text",
    					"std" 	=> "",
    					"slug"  => "portfolio-meta");
    	}
    }
    
    if($counter)
    {
    	$boxes[]    = array( 'title' =>  'Portfolio Meta Information', 'id'=>'portfolio-meta' , 'page'=>array('portfolio'), 'context'=>'side', 'priority'=>'low' );
    }
    

    with

    
    
    if(defined('ICL_LANGUAGE_CODE'))
    {
        $avia_portfolio_meta_wpml_suffix = '-'.ICL_LANGUAGE_CODE;
    
                global $sitepress;
                if(ICL_LANGUAGE_CODE == $sitepress->get_default_language())
                {
                    $avia_portfolio_meta_wpml_suffix = '';
                }
    }
    else
    {
        $avia_portfolio_meta_wpml_suffix = '';
    }
    
    /*dynamic portfolio meta fields*/
    $portfolio_metas = avia_get_option('portfolio-meta', array(array('meta'=>'Skills Needed'), array('meta'=>'Client'), array('meta'=>'Project URL')));
    
    $counter = 0;
    foreach($portfolio_metas as $p_meta)
    {
        if(!empty($p_meta['meta']))
    	{
    
    		$counter ++;
    		$elements[] = array(	
    					"name" 	=> $p_meta['meta'],
    					"desc" 	=> "" ,
    					"id" 	=> "portfolio-meta".$avia_portfolio_meta_wpml_suffix."-".$counter,
    					"type" 	=> "text",
    					"std" 	=> "",
    					"slug"  => "portfolio-meta".$avia_portfolio_meta_wpml_suffix);
    	}
    }
    
    if($counter)
    {
    	$boxes[]    = array( 'title' =>  'Portfolio Meta Information', 'id'=>'portfolio-meta'.$avia_portfolio_meta_wpml_suffix, 'page'=>array('portfolio'), 'context'=>'side', 'priority'=>'low' );
    }
    

    and in /wp-content/themes/flagship/functions-flagship.php

    
    //function to retrieve the additional portfolio options
    if(!function_exists('avia_portfolio_meta'))
    {
    	function avia_portfolio_meta($id = false, $portfolio_keys = false)
    	{
    		if(!$id) $id = get_the_ID();
    		if(!$id) return false;
    		
    		$output = "";
    		$metas = avia_post_meta($id);
    		if(!$portfolio_keys) $portfolio_keys = avia_get_option('portfolio-meta', array(array('meta'=>'Skills Needed'), array('meta'=>'Client'), array('meta'=>'Project URL')));
    		
    		
    		$p_metas = array();
    		foreach($metas as $key =>$meta)
    		{
    			if(strpos($key,'portfolio-meta-') !== false)
    			{
    				$newkey = str_replace("portfolio-meta-","",$key);
    				$p_metas[$newkey-1] = $meta;
    			}
    		}
    		
    		$counter = 0;
    		foreach($portfolio_keys as $key)
    		{
    			if(!empty($p_metas[$counter]))
    			{
    				//convert urls
    				if(avia_portfolio_url($p_metas[$counter]))
    				{
    					$linktext = $p_metas[$counter];
    					if(strlen($linktext) > 50) $linktext = __('Link','avia_framework');
    					$p_metas[$counter] = "<a href='".$p_metas[$counter]."'>".$linktext."</a>";
    				}
    				
    				$output .= "<li><strong class='portfolio-meta-key'>".$key['meta'].":</strong> <div class='portfolio-meta-value'>".$p_metas[$counter]."</div></li>";
    			}
    			$counter++;
    		}
    		
    		if($output) $output = "<ul class='portfolio-meta-list'>".$output."</ul>";
    		return $output;
    	}
    }
    

    with

    
    //function to retrieve the additional portfolio options
    if(!function_exists('avia_portfolio_meta'))
    {
    	function avia_portfolio_meta($id = false, $portfolio_keys = false)
    	{
    		if(!$id) $id = get_the_ID();
    		if(!$id) return false;
    		
    		$output = "";
    		$metas = avia_post_meta($id);
    		if(!$portfolio_keys) $portfolio_keys = avia_get_option('portfolio-meta', array(array('meta'=>'Skills Needed'), array('meta'=>'Client'), array('meta'=>'Project URL')));
            
            if(defined('ICL_LANGUAGE_CODE'))
            {
                $avia_portfolio_meta_wpml_suffix = '-'.ICL_LANGUAGE_CODE;
    
                global $sitepress;
                if(ICL_LANGUAGE_CODE == $sitepress->get_default_language())
                {
                    $avia_portfolio_meta_wpml_suffix = '';
                }
            }
            else
            {
                $avia_portfolio_meta_wpml_suffix = '';
            }
    		
    		$p_metas = array();
    		foreach($metas as $key =>$meta)
    		{
    			if(strpos($key,'portfolio-meta'.$avia_portfolio_meta_wpml_suffix.'-') !== false)
    			{
    				$newkey = str_replace('portfolio-meta'.$avia_portfolio_meta_wpml_suffix.'-',"",$key);
    				$p_metas[$newkey-1] = $meta;
    			}
    		}
    		
    		$counter = 0;
    		foreach($portfolio_keys as $key)
    		{
    			if(!empty($p_metas[$counter]))
    			{
    				//convert urls
    				if(avia_portfolio_url($p_metas[$counter]))
    				{
    					$linktext = $p_metas[$counter];
    					if(strlen($linktext) > 50) $linktext = __('Link','avia_framework');
    					$p_metas[$counter] = "<a href='".$p_metas[$counter]."'>".$linktext."</a>";
    				}
    				
    				$output .= "<li><strong class='portfolio-meta-key'>".$key['meta'].":</strong> <div class='portfolio-meta-value'>".$p_metas[$counter]."</div></li>";
    			}
    			$counter++;
    		}
    		
    		if($output) $output = "<ul class='portfolio-meta-list'>".$output."</ul>";
    		return $output;
    	}
    }
    

    This code mod is not backwards compatible but we can be sure that different portfolio meta fields are used for different languages. I tested it with one entry : http://www.walk-in-greece.com/home/proorismoi-item/del-mare/ and http://www.walk-in-greece.com/home/en/proorismoi-item/del-mare-2/

    • This reply was modified 7 months, 1 week ago by  Dude.
    #161607

    Ηi!

    But all my meta information field entries are now lost !!!! And there are a lot of entries…

    Penelope!

    #161653

    I have a very serious problem after your modifications, ALL MY PORTFOLIO ENTRIES HAVE LOST THEIR META INFORMATION ENTRIES. Please tell me what to do. I have system backups from my hosting server every day. Can I restore them ?

    Thanks
    Penelope

    #161665

    Please try to restore the database with the backup file from yesterday. I modified the code a bit (already made the changes on your server). Now it will only set different portfolio meta fields if the language is different from the primary language (in your case Greek) which means that you’ll only loose the post meta fields of the English portfolio entries.

    If the database restore doesn’t help you can also restore all files and revert the code changes (including my changes I posted above) but then the bug won’t be fixed.

    • This reply was modified 7 months, 1 week ago by  Dude.
    • This reply was modified 7 months, 1 week ago by  Dude.
    #161699

    Hi!

    I have restored also the files you have modified. I think that is a generally conflict between Flagship and WPML. I tried to add a new portfolio in Greek Theme Options – Portfolio and it showed the english portfolio categories not the greek ones to choose. Could you please inform Kriesi about this ?

    Thank you for your help,
    Penelope

    #161701

    Sure. I sent Kriesi a mail.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Template Builder and WPML’ is closed to new replies.