• 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)
  • 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

    (@sepika)

    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.