WordPress.org

Ready to get started?Download WordPress

Forums

qTranslate with Smooth Slider (12 posts)

  1. QuestionBoy
    Member
    Posted 2 years ago #

    I installed and got qTranslate fully functional. I then realized that although it was translating the posts, it was not translating the Smooth Slider plugin content. Is there a way to fix it so the Slider content is translated as well?

  2. QuestionBoy
    Member
    Posted 2 years ago #

    I found a very odd work around. I am confused because it works seamlessly for the $post_title but then requires a workaround for the $slider_excerpt?

    What I did was in the Smooth Slider j.php files (around line 173) I wrapped the textual variables with the qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage()

    so $post_title became qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($post_title)

    same for $slider_excerpt

    Now this change made the titles works just fine, but for some reason the excerpt themselves still displayed each language concatenated. to solve this last delema, I merely added the language shortcode to each post text.

    So I start every english post with [:en] and every french post with [:fr]

    And voila, it works. I still am hoping to remedy the problem so I don't need this last step and would love it if anyone can make any suggestions.

  3. Jan.lipavsky@gmail.com
    Member
    Posted 2 years ago #

    working for me with post_title,

    thnks

  4. PatrizioRD
    Member
    Posted 2 years ago #

    Thanks QuestionBoy,

    your workaround works good to me too, with both title and content.

  5. aleksand
    Member
    Posted 2 years ago #

    Thanks,
    workaround works good, with both title and content.
    In addition to this, if you want title of the post in Smooth Slider to reference to your post in your current language, on the same line QuestionBoy specified change $permalink into qtrans_convertURL($permalink)
    --
    use qtrans_convertURL() to parse the urls.
    http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=1133&hilit=link+to+language#p4438

  6. sognonemo
    Member
    Posted 2 years ago #

    Thank you guys!

    For the content I change the line 50:

    $slider_content = $data->post_content;

    with:
    $slider_content = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($data->post_content);

    And it works!!!

    :-)

  7. shyntaxx
    Member
    Posted 2 years ago #

    Is there a way to do the same for the "Custom Thumbnail Image(url)" ?
    So we can set different image for different language .

    If someone could help me out ...
    Thanks in advance!

  8. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 2 years ago #

    shyntaxx, please start a new topic as you are asking a different question to the one this topic covers.

  9. idejuan
    Member
    Posted 1 year ago #

    inspired by this post I used that hack to solve the same problem with the WooSlider Plugin, adding this function:

    qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage()

    to $v['content']

    which can be found around line 98 in file class-wooslider-sliders.php

    thank you very much. This community rocks!!

  10. jhauer
    Member
    Posted 1 year ago #

    I'm trying to translate the text in the slider in the Leverage theme at http://modernlanguages.com . I think I'm on the right track using your suggestion but it just isn't working. I'm not a php guy (a hack at best) so it is probably a syntax error. Any idea what I might be doing wrong? This has been a six day Odyssey. Please help!

    In my slider.php file:

    <div id="slideshow">
    	<div id="slides">	
    
    		<?php query_posts('post_type=any&meta_key=_ttrust_in_slideshow_value&meta_value=true&posts_per_page=10'); ?>
    		<?php $i = 0; ?>
    		<?php if(have_posts()) :?>
    
    		<?php while (have_posts()) : the_post(); ?>			
    
    		<div id="slide<?php echo $i; ?>" class="clearfix slide" <?php if($i > 0) echo('style="display: none;"'); ?> >
    
    			<?php $slideLink = get_permalink(); ?>				
    
    				<?php $slideshow_alt_img = get_post_meta($post->ID, "_ttrust_alt_image_value", true);  ?>
    				<?php $slideshow_video = get_post_meta($post->ID, "_ttrust_slideshow_video_value", true);  ?>				
    
    				<?php if($slideshow_video) : ?>
    					<div class="slideVideo">
    		    			<?php echo $slideshow_video; ?>
    					</div>
    				<?php elseif($slideshow_alt_img) : ?>
    					<div class="slideImage">
    		    			<img src="<?php echo $slideshow_alt_img; ?>" alt="<?php the_title(); ?>" />
    					</div>
    				<?php else : ?>
    					<div class="slideImage thumbnail">
    						<?php if(has_post_thumbnail()) : ?>
    		    				<?php the_post_thumbnail('ttrust_slideshow', array('alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'')); ?>
    						<?php endif; ?>
    					</div>
    				<?php endif; ?>	
    
    				<div class="slideText">
    					<h3><a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_title(); ?></a></h3>
    					<?php $preview_text = get_post_meta($post->ID, "_ttrust_preview_text_value", true); ?>
    					<?php $myFilteredText = __($preview_text); ?>
    					<?php if(!$myFilteredText) : ?>
    						<?php $slideshow_text = $post->post_content; echo wpautop(substr($slideshow_text, 0, strpos($slideshow_text, "<!--more-->"))); ?>
    						<?php more_link(); ?>
    					<?php else :
    						echo(wpautop(do_shortcode($myFilteredText)));
    					endif; ?>
    				</div>
    		</div>
    		<?php $i++; endwhile; ?>
    		<?php wp_reset_query();?>
    
    		<?php else: ?>
    			<div class="slide">
    			<div class="slideImage">
        			<img src="<?php bloginfo('template_url') ?>/images/welcome.png" width="485" height="352" alt="welcome" />
    			</div>
    			<div class="slideText">
    				<h3>Welcome</h3>
    				<h4>Thank you for purchasing the Leverage theme by Theme Trust.</h4>
    				<p>This is the home page slideshow. Here you can feature your best products or services. You can include any post or page here.</p>
    				<p><a href="<?php bloginfo('url'); ?>/wp-admin/" class="button">Start Adding Content</a></p>
    			</div>
    			</div>
    		<?php endif; ?>		
    
    	</div>
    
    	<?php if($i > 1) : ?>
    	<div id="slideshowControls">
    		<div id="slideshowNav">
    			<span id="slideshowPrev"></span>
    			<div id="slideshowNavPager"></div>
    			<span id="slideshowNext"></span>
    		</div>
    	</div>
    	<?php endif; ?>
    </div>
  11. deifos
    Member
    Posted 1 year ago #

    Hey J willing to help let me know if you still need assitance, I need to check some files of your theme, I'm not an expert but I'm willing :D.

    all the best!

  12. jhauer
    Member
    Posted 1 year ago #

    Thanks @deifos. Assuming you need the original slideshow.php file. Contents of that file are:

    <div id="slideshow">
    	<div id="slides">	
    
    		<?php query_posts('post_type=any&meta_key=_ttrust_in_slideshow_value&meta_value=true&posts_per_page=10'); ?>
    		<?php $i = 0; ?>
    		<?php if(have_posts()) :?>
    
    		<?php while (have_posts()) : the_post(); ?>			
    
    		<div id="slide<?php echo $i; ?>" class="clearfix slide" <?php if($i > 0) echo('style="display: none;"'); ?> >
    
    			<?php $slideLink = get_permalink(); ?>				
    
    				<?php $slideshow_alt_img = get_post_meta($post->ID, "_ttrust_alt_image_value", true);  ?>
    				<?php $slideshow_video = get_post_meta($post->ID, "_ttrust_slideshow_video_value", true);  ?>				
    
    				<?php if($slideshow_video) : ?>
    					<div class="slideVideo">
    		    			<?php echo $slideshow_video; ?>
    					</div>
    				<?php elseif($slideshow_alt_img) : ?>
    					<div class="slideImage">
    		    			<img src="<?php echo $slideshow_alt_img; ?>" alt="<?php the_title(); ?>" />
    					</div>
    				<?php else : ?>
    					<div class="slideImage thumbnail">
    						<?php if(has_post_thumbnail()) : ?>
    		    				<?php the_post_thumbnail('ttrust_slideshow', array('alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'')); ?>
    						<?php endif; ?>
    					</div>
    				<?php endif; ?>	
    
    				<div class="slideText">
    					<h3><a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_title(); ?></a></h3>
    					<?php $preview_text = get_post_meta($post->ID, "_ttrust_preview_text_value", true); ?>
    					<?php if(!$preview_text) : ?>
    						<?php $slideshow_text = $post->post_content; echo wpautop(substr($slideshow_text, 0, strpos($slideshow_text, "<!--more-->"))); ?>
    						<?php more_link(); ?>
    					<?php else :
    						echo(wpautop(do_shortcode($preview_text)));
    					endif; ?>
    				</div>
    		</div>
    		<?php $i++; endwhile; ?>
    		<?php wp_reset_query();?>
    
    		<?php else: ?>
    			<div class="slide">
    			<div class="slideImage">
        			<img src="<?php bloginfo('template_url') ?>/images/welcome.png" width="485" height="352" alt="welcome" />
    			</div>
    			<div class="slideText">
    				<h3>Welcome</h3>
    				<h4>Thank you for purchasing the Leverage theme by Theme Trust.</h4>
    				<p>This is the home page slideshow. Here you can feature your best products or services. You can include any post or page here.</p>
    				<p><a href="<?php bloginfo('url'); ?>/wp-admin/" class="button">Start Adding Content</a></p>
    			</div>
    			</div>
    		<?php endif; ?>		
    
    	</div>
    
    	<?php if($i > 1) : ?>
    	<div id="slideshowControls">
    		<div id="slideshowNav">
    			<span id="slideshowPrev"></span>
    			<div id="slideshowNavPager"></div>
    			<span id="slideshowNext"></span>
    		</div>
    	</div>
    	<?php endif; ?>
    </div>

Topic Closed

This topic has been closed to new replies.

About this Topic