• Hi, I’m developing a bilingual website that utilizes slideshow plugins, and one of them (Listic Slider) is outputting both languages (EN & ZH). Do you know how I can tweak it so it only generates the EN title by default?

    Here’s the code within the plugin that generates the title:

    if($permalink!='') {
    			$html .= '<h2 '.$listic_slider_css['listic_slider_h2'].'><a href="'.$permalink.'" '.$listic_slider_css['listic_slider_h2_a'].' '.$listic_slider_curr['a_attr'].'>'.$post_title.'</a></h2>
    			    '.$slider_excerpt.$fields_html;

    If you can’t assist me because this is an issue with the other plugin, can you advise as to how qTranslate knows which language to output so I can ask the plugin developer the right question? Thanks!

    Link: https://design.drzzl.com/neocha2/agency/

    https://www.ads-software.com/extend/plugins/qtranslate/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter drizzlesauce

    (@drizzlesauce)

    Hmm, it looks like the issue might not be with the plugin, but rather that my template’s not reading the
    <!--:en-->Return to Top<!--:--><!--:zh-->回顶部<!--:-->
    function. Can you direct me to where I can activate this in my templates?

    Hey drizzle,
    I just found how to get qtranslate to work with the listic slider (at least v1.1.1 and WP v3.5.1).

    It involves adding the following code around php elements in two of the listic slider php files, in numerous places. I basically took the idea from qTranslate’s support forum, which gives the basic idea and instructions:

    https://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=294

    In listic_1.php, you want to find references to $post_title, $slider_content, and wrap with a function that implements qTranslate.

    so you’ll find something like the following (in at least two places in listic_1.php):

    $post_title = stripslashes($data->post_title);
    	$post_title = str_replace('"', '', $post_title);
    	$slider_content = $data->post_content;

    and replace it with:

    if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $post_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage(stripslashes($data->post_title));
    		if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $post_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage(str_replace('"', '', $post_title));
    		if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $slider_content = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($data->post_content);

    In order to get it to work with the rest of the features of the slider, I also did the same basic procedure (wrapping variables with the qTranslate code) for other variables, like $sldr_title, from:

    else $sldr_title = $listic_slider_curr['title_text'];

    to:

    else if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $sldr_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($listic_slider_curr['title_text']);

    also places (i found it twice i think) like:

    if(!empty($title)){ $sldr_title = $title;}
    	else{ $sldr_title = $listic_slider_curr['title_text']; 	}

    to:

    if(!empty($title)){ if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $sldr_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($title);}
    	else{ if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $sldr_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($listic_slider_curr['title_text']); 	}

    and:

    $sldr_title = $listic_slider_curr['title_text']; if(!empty($sldr_title)) { $slider_title_margin = "5px 0 10px 0"; } else {$slider_title_margin = "0";}

    to:

    if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $sldr_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($listic_slider_curr['title_text']); if(!empty($sldr_title)) { $slider_title_margin = "5px 0 10px 0"; } else {$slider_title_margin = "0";}

    Then it also seemed necessary to edit the shortcodes_1.php file too, with the same basic idea.

    From:

    if($listic_slider_curr['title_from']=='1') $sldr_title = get_listic_slider_name($slider_id);
    	else $sldr_title = $listic_slider_curr['title_text'];
    
    	if(!empty($sldr_title)) {
    	  $sldr_title = '<div class="sldr_title" '.$listic_slider_css['sldr_title'].'>'. $sldr_title .'</div>';

    to:

    if($listic_slider_curr['title_from']=='1') $sldr_title = get_listic_slider_name($slider_id);
    	else if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $sldr_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($listic_slider_curr['title_text']);
    
    	if(!empty($sldr_title)) {
    	  if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $sldr_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage('<div class="sldr_title" '.$listic_slider_css['sldr_title'].'>'. $sldr_title .'</div>');

    and

    if(!empty($title)){ $sldr_title = $title;}
    	else{ $sldr_title = $listic_slider_curr['title_text']; 	}
    
    	if(!empty($sldr_title)) {
    	  $sldr_title = '<div class="sldr_title" '.$listic_slider_css['sldr_title'].'>'. $sldr_title .'</div>';

    to:

    if(!empty($title)){ if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $sldr_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($title);}
    	else{ if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $sldr_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($listic_slider_curr['title_text']); 	}
    
    	if(!empty($sldr_title)) {
    	  if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $sldr_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage('<div class="sldr_title" '.$listic_slider_css['sldr_title'].'>'. $sldr_title .'</div>');

    I hope this helps. I am NOT a php coder so the above might be a bit overkill, but it works for me, and translates the titles, content, and also works with the shortcodes. I had to edit the shortcode file because I am using the shortcode to get listic to display posts in a particular category, and it seemed that was necessary.

    Good luck; i know this took me many hours to solve…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: qTranslate] Slideshow plugin outputting both languages’ is closed to new replies.