• Resolved repot

    (@repot)


    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.

    http://wordpress.org/plugins/polylang/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter repot

    (@repot)

    Code 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++;
    				?>

    Waiting for a right kind of pilot to come… Please, really need it.

    Plugin Author Chouby

    (@chouby)

    Just add the lang parameter in your query:

    $num_posts_query = new WP_Query( (( $category ) ? "cat=".$category."&": '')."showposts=".$posts_num."&offset=".$offset."&lang=en" );

    Thread Starter repot

    (@repot)

    Just elegant and awesome! Thank you, Chouby!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Polylang and recent post WIDGET-how to force English?’ is closed to new replies.