Title: Exclude excerpt from wp_query
Last modified: August 31, 2016

---

# Exclude excerpt from wp_query

 *  [sepika](https://wordpress.org/support/users/sepika/)
 * (@sepika)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/exclude-excerpt-from-wp_query/)
 * Hellow everyone!
    I am showing blog of posts in additional template and everything
   works fine, but I’ve made some kind of gallery from it, and I don’t need to show
   anything except images and title.
 * How could I exclude excerprt, text, etc? Really appreciate your help!
 * My code:
 *     ```
       <?php
       /*
        * Template name: Блог
        */
       $current_page = (get_query_var('paged')) ? get_query_var('paged') : 1;
       $args = array(
       	'posts_per_page' => 9,
       	'paged'          => $current_page,
           'cat'            => 8
       );
       query_posts( $args );
   
       $wp_query->is_archive = true;
       $wp_query->is_home = false;
   
       while(have_posts()): the_post();
       	?>
       	<div class="foto_posts">
               <?php the_content()  ?>
             <?php  echo '<a href="' . get_permalink() . '" class="foto_title" target="_blank">' . get_the_title() . '</a>';?>
               </div>
       	<?php
       endwhile;
   
       if(function_exists('page_navi_slider')) page_navi_slider();
       ```
   

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

 *  [Clarion Technologies](https://wordpress.org/support/users/clarionwpdeveloper/)
 * (@clarionwpdeveloper)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/exclude-excerpt-from-wp_query/#post-7128725)
 * Please find the below updated code:Just removed <?php the_content() ?>
    Add this
   code:
 *     ```
       <?php
       /*
        * Template name: Блог
        */
       $current_page = (get_query_var('paged')) ? get_query_var('paged') : 1;
       $args = array(
       	'posts_per_page' => 9,
       	'paged'          => $current_page,
           'cat'            => 8
       );
       query_posts( $args );
   
       $wp_query->is_archive = true;
       $wp_query->is_home = false;
   
       while(have_posts()): the_post();
       	?>
       	<div class="foto_posts">
   
             <?php  echo '<a href="' . get_permalink() . '" class="foto_title" target="_blank">' . get_the_title() . '</a>';?>
               </div>
       	<?php
       endwhile;
   
       if(function_exists('page_navi_slider')) page_navi_slider();
       ```
   
 *  Thread Starter [sepika](https://wordpress.org/support/users/sepika/)
 * (@sepika)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/exclude-excerpt-from-wp_query/#post-7128731)
 * > Please find the below updated code:Just removed <?php the_content() ?>
 * Unfortunately it excludes images too. My post consistes from:
 *     ```
       [gallery ids="1618,...,1634"]
       <h2>...</h2>
       <p>...</p>
       text without format, etc.
       ```
   
 * So I need the gallery shortcode to stay, and all other content exclude from the
   loop… That’s the point(

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

The topic ‘Exclude excerpt from wp_query’ is closed to new replies.

## Tags

 * [excerpt](https://wordpress.org/support/topic-tag/excerpt/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * 2 replies
 * 2 participants
 * Last reply from: [sepika](https://wordpress.org/support/users/sepika/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/exclude-excerpt-from-wp_query/#post-7128731)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
