WordPress.org

Support

Support » Plugins and Hacks » Polylang » [Resolved] Force default language in Recent Posts Widget

[Resolved] 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. 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/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Force default language in Recent Posts Widget’ is closed to new replies.
Skip to toolbar