Title: jsarapik's Replies | WordPress.org

---

# jsarapik

  [  ](https://wordpress.org/support/users/jsarapik/)

 *   [Profile](https://wordpress.org/support/users/jsarapik/)
 *   [Topics Started](https://wordpress.org/support/users/jsarapik/topics/)
 *   [Replies Created](https://wordpress.org/support/users/jsarapik/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/jsarapik/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/jsarapik/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/jsarapik/engagements/)
 *   [Favorites](https://wordpress.org/support/users/jsarapik/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Sublanguage] Displaying only translated content](https://wordpress.org/support/topic/displaying-only-translated-content/)
 *  Thread Starter [jsarapik](https://wordpress.org/support/users/jsarapik/)
 * (@jsarapik)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/displaying-only-translated-content/#post-7249982)
 * Thank you so much for the reply! It is doing the trick but not quite.
    At first
   i didnt think it worked but after trying it out in another part of the template
   I can see what its doing.
 * The code:
 *     ```
       <div class="grid_wrapper">
                 <?php
                   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                   $args = array (
                       'category_name'  => 'Artiklid',
                       'post_type'      => 'post',
                       'posts_per_page' => 5, //showposts is deprecated
                       'paged'          => $paged,
                       'orderby'        => 'date',
                       'order'          => DESC,
                   );
                 global $sublanguage;
                 ?>
                 <?php $cat_posts = new WP_query($args) ?>
                 <?php
                 // globalize $wp_query
                 global $wp_query;
                 // copy $wp_query into a temporary variable
                 $temp_wp_query = $wp_query;
                 // nullify $wp_query
                 $wp_query = null;
                 // move $loop into $wp_query
                 $wp_query = $cat_posts;
                 ?>
                 <?php if ($cat_posts->have_posts()) : while ($cat_posts->have_posts()) : $cat_posts->the_post(); ?>
                 <?php if (empty($sublanguage) || $sublanguage->is_main() && $cat_posts->post->post_content || $sublanguage->is_sub() && $cat_posts->post->post_content != apply_filters( 'sublanguage_translate_post_field', $cat_posts->post->post_content, $cat_posts->post, 'post_content')) { ?>
                  <?php $c++;
                 if( $c == 1) :?>
   
               <div id="viimati_ilmunud_uudis" class="post_main card" style="margin-left:0px;">
                 <h1><?php the_title(); ?></h1>
                 <p class="publish_data">
                   <?php the_time('d.m.Y') ?> |
                   <?php echo strip_tags(get_the_tag_list('',', ','')); ?>
                 </p>
                 <p><?php the_excerpt(); ?></p>
                 <a class="btn waves-effect waves-light" href="<?php the_permalink() ?>"><?php echo get_the_title(166) ?></a>
               </div>
               <div class="spacer"></div>
                 <?php else :?>
                   <div class="post_preview card">
                     <h1><?php the_title(); ?></h1>
                     <p class="publish_data">
                       <?php the_time('d.m.Y') ?> |
                       <?php echo strip_tags(get_the_tag_list('',', ','')); ?>
                     </p>
                     <p><?php the_excerpt(); ?></p>
                     <a class="btn waves-effect waves-light" href="<?php the_permalink() ?>"><?php echo get_the_title(166) ?></a>
                   </div>
                   <?php endif;?>
                   <?php } ?>
                 <?php endwhile; endif ?>
             </div>
       ```
   
 * This part is paginated. All the non translated posts are removed but i have to
   click through the pagination to get to the translated ones. Until i get to the
   translated posts i see only the previous and next page links and nothing else.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Sublanguage] Displaying only translated content](https://wordpress.org/support/topic/displaying-only-translated-content/)
 *  Thread Starter [jsarapik](https://wordpress.org/support/users/jsarapik/)
 * (@jsarapik)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/displaying-only-translated-content/#post-7249979)
 * Im having trouble adding it into my code. Not that strong with php.
 * This is the code i am using at the moment
 *     ```
       <div class="grid_wrapper">
               <?php
                 $args = array (
                     'category_name' => 'Artiklid',
                     'posts_per_page' => 4,
                     'orderby' => 'date',
                 );
               ?>
   
               <?php $cat_posts = new WP_query($args) ?>
   
               <?php if ($cat_posts->have_posts()) : while ($cat_posts->have_posts()) : $cat_posts->the_post(); ?>
   
                 <div class="post_preview card">
                   <h1><?php the_title(); ?></h1>
                   <p class="publish_data">
                     <?php the_time('d.m.Y') ?> |
                     <?php echo strip_tags(get_the_tag_list('',', ','')); ?>
                   </p>
                   <p><?php the_excerpt(); ?></p>
                   <a class="btn waves-effect waves-light" href="<?php the_permalink() ?>"><?php echo get_the_title(166) ?></a>
                 </div>
               <?php endwhile; endif?>
   
               <a href="artiklid" id="last" class="show_more_btn"><?php echo get_the_title(172) ?></a>
   
             </div>
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Sublanguage] How to change media files](https://wordpress.org/support/topic/how-to-change-media-files/)
 *  Thread Starter [jsarapik](https://wordpress.org/support/users/jsarapik/)
 * (@jsarapik)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/how-to-change-media-files/#post-7229661)
 * It is as i feared.
 * Would you have any reccomendations on how to get the functionality I am after?

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