Title: Force default language in Recent Posts Widget
Last modified: August 21, 2016

---

# Force default language in Recent Posts Widget

 *  Resolved [repot](https://wordpress.org/support/users/repot/)
 * (@repot)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/force-default-language-in-recent-posts-widget/)
 * Hello
    Please help me to modify Recent post widget to force default language 
   post if translation isn’t available. I’ve got a solution for index.php files 
   etc [here](http://wordpress.org/support/topic/plugin-polylang-showing-default-language-post-if-no-translation-is-available?replies=13).
   And I’m trying to do the same with my widget code. Please help me to modify the
   code from widget to show english posts only. This is widget code fragment to 
   be modified:
 *     ```
       echo ( $title )? $before_widget . $before_title . $title . $after_title:$before_widget;
   
       		$num_posts_query = new WP_Query( (( $category ) ? "cat=".$category."&": '')."showposts=".$posts_num."&offset=".$offset );
   
       		if( $num_posts_query->have_posts()) {
       		$counter = 0;
       		?>
       		    <div class="wpalp">
       			<ul class="wpalp_thumbnails<?php echo ($thumbnails_only)?' wpalp_thumbonly':''; echo ($thumbnails)?' wpalp_thumbs':'';?>">
       <?php			    while( $num_posts_query->have_posts()) : $num_posts_query->the_post();
       			    update_post_caches($posts);
       				$counter++;
       				?>
       				<li style="<?php echo ($thumbnails_only)?'float:left;':'clear:both;';?>" <?php echo ($counter < $posts_num)?'class="'.$pb.'"':"";?>>
       <?php
       if ($thumbnails ) {
       	$thumbfound=false;
       	$shadow_class="";
       	global $post;
   
       	$post_da_thumb = (get_post_meta($post->ID, 'post_thumbnail', true)) ? get_post_meta($post->ID, 'post_thumbnail', true) : get_post_meta($post->ID, 'thumbnail', true);
   
       	if(has_post_thumbnail()) {
       			$post_da_thumb=wp_get_attachment_url( get_post_thumbnail_id() );
       		}
   
       	$frame_class = ($frame == '' || $frame == false) ? '': ' wpalp_thumb_frame';
       	if($frame_class != '')
       		$shadow_class = ($shadow == '' || $shadow == false) ? '': ' wpalp_frameshadow';
       	// try "Get The Image" plugin
       	if ( function_exists('get_the_image') ) {
       ```
   
 * [http://wordpress.org/plugins/polylang/](http://wordpress.org/plugins/polylang/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [repot](https://wordpress.org/support/users/repot/)
 * (@repot)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/force-default-language-in-recent-posts-widget/#post-4451095)
 * resolved here [http://wordpress.org/support/topic/polylang-and-recent-post-widget-how-to-force-english?replies=4#post-5044381](http://wordpress.org/support/topic/polylang-and-recent-post-widget-how-to-force-english?replies=4#post-5044381)

Viewing 1 replies (of 1 total)

The topic ‘Force default language in Recent Posts Widget’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

## Tags

 * ["recent post"](https://wordpress.org/support/topic-tag/recent-post/)
 * [default](https://wordpress.org/support/topic-tag/default/)

 * 1 reply
 * 1 participant
 * Last reply from: [repot](https://wordpress.org/support/users/repot/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/force-default-language-in-recent-posts-widget/#post-4451095)
 * Status: resolved