Title: Problem translating widgets
Last modified: August 30, 2016

---

# Problem translating widgets

 *  Resolved [Rudixx](https://wordpress.org/support/users/rudixx/)
 * (@rudixx)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/)
 * Hello, I am having difficulty to fix the issue with the carousel widget. It is
   in the centre of the page.
 * [http://pl.pctronic.co.uk/](http://pl.pctronic.co.uk/)
 * There should be 3 images above each service but they are not displayed while 
   qtranslate-x is active. Any idea how to fix them?
 *     ```
       <?php
       // =============================== My Carousel widget ======================================
       class MY_CarouselWidget extends WP_Widget {
           /** constructor */
           function MY_CarouselWidget() {
               parent::WP_Widget(false, $name = 'My - Carousel');
           }
   
           /** @see WP_Widget::widget */
           function widget($args, $instance) {
               extract( $args );
               $title = apply_filters('widget_title', $instance['title']);
       				$limit = apply_filters('widget_limit', $instance['limit']);
       				$category = apply_filters('widget_category', $instance['category']);
       				$count = apply_filters('widget_count', $instance['count']);
               ?>
       				<?php echo $before_widget; ?>
       					<?php if ( $title )
       								echo $before_title . $title . $after_title; ?>
   
       							<!-- Elastislide Carousel -->
       							<div id="carousel" class="es-carousel-wrapper">
       								<div class="es-carousel">
       									<ul>
       										<?php $limittext = $limit;?>
       										<?php global $more;	$more = 0;?>
       										<?php query_posts("posts_per_page=". $count ."&post_type=" . $category);?>
       										<?php while (have_posts()) : the_post(); ?>
   
       										<?php
       										$thumb = get_post_thumbnail_id();
       										$img_url = wp_get_attachment_url( $thumb,'full'); //get img URL
       										$image = aq_resize( $img_url, 212, 107, true ); //resize & crop img
       										?>
   
       										<li>
   
       										<?php if(has_post_thumbnail()) { ?>
       											<figure class="thumbnail"><a href="<?php the_permalink(); ?>"><img src="<?php echo $image ?>" alt="<?php the_title(); ?>" /></a></figure>
       										<?php } ?>
   
       											<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
   
       										<?php if($limittext!="" || $limittext!=0){ ?>
   
       											<div class="excerpt"><?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,$limittext); ?></div>
   
       										<?php } ?>
       											<a href="<?php the_permalink() ?>" class="link"><?php _e('more', 'hotel'); ?></a>
   
       											<?php the_meta(); ?>
   
       										</li>
   
       										 <?php endwhile; ?>
       										<?php wp_reset_query(); ?>
       									</ul>
       								</div>
       							</div>
       							<script type="text/javascript">
       								jQuery('#carousel').elastislide({
       									imageW 	: 130,
       									minItems	: 1,
       									maxItems	: 3,
       									onClick		: function() {}
       								});
       							</script>
       							<!-- End Elastislide Carousel -->
   
       				<?php echo $after_widget; ?>
               <?php
           }
   
           /** @see WP_Widget::update */
           function update($new_instance, $old_instance) {
               return $new_instance;
           }
   
           /** @see WP_Widget::form */
           function form($instance) {
       			$title = esc_attr($instance['title']);
       			$limit = esc_attr($instance['limit']);
       			$category = esc_attr($instance['category']);
       			$count = esc_attr($instance['count']);
           ?>
             <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'compRepair'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
   
             <p><label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('Limit Text:', 'compRepair'); ?> <input class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit; ?>" /></label></p>
             <p><label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Posts per page:', 'compRepair'); ?><input class="widefat" style="width:30px; display:block; text-align:center" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" type="text" value="<?php echo $count; ?>" /></label></p>
   
             <p><label for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post type:', 'compRepair'); ?><br />
   
             <select id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>" style="width:150px;" >
             <option value="testi" <?php echo ($category === 'testi' ? ' selected="selected"' : ''); ?>>Testimonials</option>
             <option value="portfolio" <?php echo ($category === 'portfolio' ? ' selected="selected"' : ''); ?> >Portfolio</option>
             <option value="offers" <?php echo ($category === 'offers' ? ' selected="selected"' : ''); ?> >Offers Post</option>
             <option value="" <?php echo ($category === '' ? ' selected="selected"' : ''); ?>>Blog</option>
             </select>
             </label></p>
   
             <?php
           }
   
       } // class Carousel Widget
       ?>
       ```
   
 *     ```
       <?php
       // created by Eugene Chernomor eugeneweblab@gmail.com
       // v. 28.0214
   
       // =============================== My Carousel widget ======================================
       class MY_FredCarouselWidget extends WP_Widget {
           /** constructor */
           function MY_FredCarouselWidget() {
               parent::WP_Widget(false, $name = 'My - FredCarousel');
           }
   
           /** @see WP_Widget::widget */
           function widget($args, $instance) {
               extract( $args );
               $title = apply_filters('widget_title', $instance['title']);
       		$limit = apply_filters('widget_limit', $instance['limit']);
       		$cats = apply_filters('widget_cats', $instance['cats']);
       		$count = apply_filters('widget_count', $instance['count']);
       		$thumb_w = apply_filters('widget_thumb_w', $instance['thumb_w']);
       		$thumb_h = apply_filters('widget_thumb_h', $instance['thumb_h']);
       		$show_type = apply_filters('widget_show_type', $instance['show_type']);
       		$linktext = apply_filters('widget_linktext', $instance['linktext']);
       		$linkChecker = apply_filters('widget_linkChecker', $instance['linkChecker']);
   
       		if( ! $thumb_h =  absint($instance["thumb_h"] ))  $thumb_h=50;
       		if( ! $thumb_w =  absint($instance["thumb_w"] ))  $thumb_w=50;
       		//if( ! $category = $instance["category"] )  $category='';
       		if( ! $show_type = $instance["show_type"] )  $show_type='post';
       		if( ! $linktext = $instance["linktext"] )  $linktext='read more';
   
               ?>
       				<?php echo $before_widget; ?>
       					<?php if ( $title )
       								echo $before_title . $title . $after_title; ?>
   
       							<!-- Elastislide Carousel -->
       							<div class="list_carousel">
       			                    <ul id="foo2">
       			                        <?php
   
       			                        $trimmed = trim($cats[0]);
   
       			                        $carouselPosts = new WP_Query();
       			                        $carouselPosts->query('category_name='.$trimmed.'&showposts='.$count.'&post_type='.$show_type);
       			                        ?>
       			                        <?php while ($carouselPosts->have_posts()) : $carouselPosts->the_post(); ?>
   
       			                        <li>
       			                        	<?php  $titlePost = str_replace('<span>', ' ', get_the_title( $post->ID )); $titlePost = str_replace('</span>', ' ', $titlePost); ?>
       			                            <a class="imgHolder" href="<?php the_permalink() ?>" title="<?php echo $titlePost; ?>">
       			                            	<?php
       												$thumb = get_post_thumbnail_id();
       												$img_url = wp_get_attachment_url( $thumb,'sliderimg'); //get img URL
       												$image = aq_resize( $img_url, $thumb_w, $thumb_h, true ); //resize & crop img
   
       												if(has_post_thumbnail()) { ?>
       													<img src="<?php echo $image ?>" alt="<?php the_title(); ?>" />
       											<?  } ?>
   
       			                            </a>
       			                            <div class="slidertitle">
       			                            	<?php $theTitle = get_the_title($ID); ?>
       				                            <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
       				                            	<?php echo $theTitle; ?>
       				                            </a>
       			                            </div>
       			                            <div class="excerpt">
       			                            	<?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,$limit); ?>
       			                            </div>
       										<?php if ($linkChecker) { ?>
       			                            <a class="details" href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php echo $linktext; ?></a>
       			                            <?php } ?>
   
       			                        </li>
   
       			                        <?php endwhile; ?>
       			                    </ul>
       			                </div>
       			              		<div class="caroNav">
       				                    <a class="prev" id="prev2" href="#"><span>prev</span></a>
       				                    <a class="next" id="next2" href="#"><span>next</span></a>
       			                    </div>
   
       							<script type="text/javascript">
       							    jQuery(function($) {
       								    $('#foo2').carouFredSel({
       								        prev: '#prev2',
       								        next: '#next2',
       								        scroll : {
       									            items           : 1,
       									            easing          : "easeOutCirc",
       									            duration        : 500,
       									            pauseOnHover    : true
       									        },
       									    auto: { play:false }
       								    });
       								});
       							</script>
       							<!-- End Elastislide Carousel -->
   
       				<?php echo $after_widget; ?>
               <?php
           }
   
           /** @see WP_Widget::update */
           function update($new_instance, $old_instance) {	
   
               return $new_instance;
           }
   
           /** @see WP_Widget::form */
           function form($instance) {
       			$title = esc_attr($instance['title']);
       			$limit = esc_attr($instance['limit']);
       			$cats = esc_attr($instance['cats']);
       			$count = esc_attr($instance['count']);
       			$thumb_w = esc_attr($instance['thumb_w']);
       			$thumb_h = esc_attr($instance['thumb_h']);
       			$show_type = esc_attr($instance['show_type']);
       			$linktext = esc_attr($instance['linktext']);
       			$linkChecker = esc_attr($instance['linkChecker']);
           ?>
   
       		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
   
             	<p><label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('Limit Text:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit; ?>" /></label></p>
   
       		<p><label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Number of posts to show:'); ?></label>
               <input id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" type="text" value="<?php echo $count; ?>" size="3" /></p>
   
               <p>
               	<label for="<?php echo $this->get_field_id("linkChecker"); ?>">
                       <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("linkChecker"); ?>" name="<?php echo $this->get_field_name("linkChecker"); ?>"<?php checked( (bool) $instance["linkChecker"], true ); ?> />
                       <?php _e( 'Show link button' ); ?>
                   </label>
                   <span style="width:20px; height:10px; display:inline-block;"></span>
               	<label for="<?php echo $this->get_field_id('linktext'); ?>"><?php _e('Text for link:'); ?></label>
               	<input id="<?php echo $this->get_field_id('linktext'); ?>" name="<?php echo $this->get_field_name('linktext'); ?>" type="text" value="<?php echo $linktext; ?>" size="10" />
               </p>
   
           <?php
               if ( function_exists('the_post_thumbnail') && current_theme_supports("post-thumbnails") ) : ?>
   
               <p>
                   <label for="<?php echo $this->get_field_id("thumb"); ?>">
                       <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("thumb"); ?>" name="<?php echo $this->get_field_name("thumb"); ?>"<?php checked( (bool) $instance["thumb"], true ); ?> />
                       <?php _e( 'Show post thumbnail' ); ?>
                   </label>
               </p>
   
               <p>
                   <label>
                       <?php _e('Thumbnail dimensions'); ?>:<br />
                       <label for="<?php echo $this->get_field_id("thumb_w"); ?>">
                           W: <input class="widefat" style="width:40%;" type="text" id="<?php echo $this->get_field_id("thumb_w"); ?>" name="<?php echo $this->get_field_name("thumb_w"); ?>" value="<?php echo $thumb_w; ?>" />
                       </label>   
   
                       <label for="<?php echo $this->get_field_id("thumb_h"); ?>">
                           H: <input class="widefat" style="width:40%;" type="text" id="<?php echo $this->get_field_id("thumb_h"); ?>" name="<?php echo $this->get_field_name("thumb_h"); ?>" value="<?php echo $thumb_h; ?>" />
                       </label>
                   </label>
               </p>
   
           <?php endif; ?>	
   
           	<p>
                   <label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e('Categories:');?> 
   
                      <?php
                          $categories=  get_categories('hide_empty=0');
                            echo "<br/>";
                            foreach ($categories as $cat) {
                                $option='<input type="checkbox" id="'. $this->get_field_id( 'cats' ) .'[]" name="'. $this->get_field_name( 'cats' ) .'[]"';
                                   if (is_array($instance['cats'])) {
                                       foreach ($instance['cats'] as $cats) {
                                           if($cats==$cat->slug) {
                                                $option=$option.' checked="checked"';
                                           }
                                       }
                                   }
                                   $option .= ' value="'.$cat->slug.'" />';
   
                                   $option .= $cat->cat_name;
   
                                   $option .= '<br />';
                                   echo $option;
                                }
   
                           ?>
                   </label>
               </p>
               <p>
                   <label for="<?php echo $this->get_field_id('show_type'); ?>"><?php _e('Show Post Type:');?>
                       <select class="widefat" id="<?php echo $this->get_field_id('show_type'); ?>" name="<?php echo $this->get_field_name('show_type'); ?>">
                       <?php
                           global $wp_post_types;
                           foreach($wp_post_types as $k=>$sa) {
                               if($sa->exclude_from_search) continue;
                               echo '<option value="' . $k . '"' . selected($k,$show_type,true) . '>' . $sa->labels->name . '</option>';
                           }
                       ?>
                       </select>
                   </label>
               </p>
             <?php
           }
       } // class Carousel Widget
       ?>
       ```
   
 * I would be really grateful if someone could lead me how to fix this problem.
 * Thank you in advance.
 * Regards,
    Rudixx
 * [https://wordpress.org/plugins/qtranslate-x/](https://wordpress.org/plugins/qtranslate-x/)

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Thread Starter [Rudixx](https://wordpress.org/support/users/rudixx/)
 * (@rudixx)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354645)
 * Widget creator is not replying. Would someone be so kind and help me out please?
 *  Plugin Author [Gunu](https://wordpress.org/support/users/grafcom/)
 * (@grafcom)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354646)
 * [@rudixx](https://wordpress.org/support/users/rudixx/)
 * what do I need to be able to reproduce this?
 *  Thread Starter [Rudixx](https://wordpress.org/support/users/rudixx/)
 * (@rudixx)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354648)
 * When qtranslate is deactivated it should look like this
 * [https://www.dropbox.com/s/pgsr8mf3r8nwztf/Zrzut%20ekranu%202015-07-25%2016.40.31.png?dl=0](https://www.dropbox.com/s/pgsr8mf3r8nwztf/Zrzut%20ekranu%202015-07-25%2016.40.31.png?dl=0)
 * when it is active the thumbnails are not displayed.
 *  Thread Starter [Rudixx](https://wordpress.org/support/users/rudixx/)
 * (@rudixx)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354649)
 * Also ignore the first code. Second one is the one I need.
 *  Plugin Author [Gunu](https://wordpress.org/support/users/grafcom/)
 * (@grafcom)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354650)
 * [@rudixx](https://wordpress.org/support/users/rudixx/)
 * > Also ignore the first code. Second one is the one I need.
 * not a very useful answer….
 * But first read this [https://qtranslatexteam.wordpress.com/faq/](https://qtranslatexteam.wordpress.com/faq/)
   and this [https://qtranslatexteam.wordpress.com/integration/](https://qtranslatexteam.wordpress.com/integration/)
 *  Thread Starter [Rudixx](https://wordpress.org/support/users/rudixx/)
 * (@rudixx)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354651)
 * What do you mean not a very useful answer? Did you read my previous message with
   the screenshot?
 * I did read them links and I am not that advanced user to actually be able to 
   fix it on my own.
 *  Plugin Author [Gunu](https://wordpress.org/support/users/grafcom/)
 * (@grafcom)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354652)
 * [@rudixx](https://wordpress.org/support/users/rudixx/)
 * ok. What theme do you use and what other plugins?
 * The carousel widget is it a part of the theme or a independent plugin?
 *  Thread Starter [Rudixx](https://wordpress.org/support/users/rudixx/)
 * (@rudixx)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354653)
 * Theme name is: **compRepair** and **my-carousel-widgeFred** is a part of this
   theme.
 * Other plugins that I use are:
    Advanced Recent Posts Widget Breadcrumb NavXT 
   Contact Form 7 Meta Slider qTranslate-X UpdraftPlus – Backup/Restore WP-PageNavi
   WP Statistics
 *  Thread Starter [Rudixx](https://wordpress.org/support/users/rudixx/)
 * (@rudixx)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354654)
 * If I Use Query Mode (?lang=en). Most SEO unfriendly, not recommended. Then it
   works fine but on any other URL Modification Mode the widget does not display
   featured images.
 *  Plugin Author [Gunu](https://wordpress.org/support/users/grafcom/)
 * (@grafcom)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354655)
 * [@rudixx](https://wordpress.org/support/users/rudixx/)
 * temporarily deactivate all other plugins and see if that makes a difference.
 *  Thread Starter [Rudixx](https://wordpress.org/support/users/rudixx/)
 * (@rudixx)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354656)
 * Done. Deactivating all other plugins made no difference. Only switching URL Modification
   Mode to Query Mode makes difference.
 *  Plugin Author [Gunu](https://wordpress.org/support/users/grafcom/)
 * (@grafcom)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354657)
 * [@rudixx](https://wordpress.org/support/users/rudixx/)
 * what is in your htaccess file?
 * Try Settings Permalinks Save Postname
 *  Thread Starter [Rudixx](https://wordpress.org/support/users/rudixx/)
 * (@rudixx)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354658)
 * .htaccess
 *     ```
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteRule ^index\.php$ - [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
       </IfModule>
   
       # END WordPress
       ```
   
 * With default (ugly) permalinks it makes no difference.
 * _[ [No bumping please](http://codex.wordpress.org/Forum_Welcome#No_Bumping). ]_

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Problem translating widgets’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/qtranslate-x_f9f9f9.svg)
 * [qTranslate X](https://wordpress.org/plugins/qtranslate-x/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/qtranslate-x/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/qtranslate-x/)
 * [Active Topics](https://wordpress.org/support/plugin/qtranslate-x/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/qtranslate-x/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/qtranslate-x/reviews/)

## Tags

 * [images](https://wordpress.org/support/topic-tag/images/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 13 replies
 * 2 participants
 * Last reply from: [Rudixx](https://wordpress.org/support/users/rudixx/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/problem-translating-widgets/#post-6354658)
 * Status: resolved