Is there a way to get query with post information (thumbnails, id, etc.) but without the_content()?
I already have plugin to show recent posts in sidebars at homepage and when it is for example 20 posts and content of every has 1MB it loads 20 MBs of content at home page which at the end is not displayed because it only shows thumbnail, title and vote/comment options. It kills the website. Is there a way to load post info to this plugin with query but excluding post's content to be loaded?
Code:
<?php $recent=new WP_Query(); ?>
<?php
$recent->query(array(
'post_type' => get_post_types(),
'cat' => 26,
'showposts' => 3,
'ignore_sticky_posts' => '1' ));
?>
<ul id="tab-recent" class="alx-tab group <?php if($instance['recent_thumbs']) { echo 'thumbs-enabled'; } ?>">
<?php while ($recent->have_posts()): $recent->the_post(); ?>
<li>
<?php if($instance['recent_thumbs']) { // Thumbnails enabled? ?>
<div class="tab-item-thumbnail">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php if ( has_post_thumbnail() ): ?>
<?php the_post_thumbnail('thumb-small'); ?>
<?php else: ?>
<img src="<?php echo get_template_directory_uri(); ?>/img/thumb-small.png" alt="<?php the_title(); ?>" />
<?php endif; ?>
<?php if ( has_post_format('video') && !is_sticky() ) echo'<span class="thumb-icon small"><i class="fa fa-play"></i></span>'; ?>
<?php if ( has_post_format('audio') && !is_sticky() ) echo'<span class="thumb-icon small"><i class="fa fa-volume-up"></i></span>'; ?>
<?php if ( is_sticky() ) echo'<span class="thumb-icon small"><i class="fa fa-star"></i></span>'; ?>
</a>
</div>
<?php } ?>
<div class="tab-item-inner group">
<p class="tab-item-title">
<?php $posttitle = get_the_title(); ?>
<?php if (strlen($posttitle) > 19) {
echo '<a href="' . get_permalink() . '">' .substr(the_title($before = '', $after = '', FALSE), 0, 19) . '...' . '</a>';
} else {
echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
} ?>
</p>
<div class="content">
<?php the_content(); //I WANT REMOVE THIS LINE ?>
</div>
<div class="stats">
<div class="recommendation">
<?php if(function_exists('wpv_voting_display_vote')) wpv_voting_display_vote(get_the_ID()); ?>
</div>
<div class="comments-count">
<?php comments_number( '0', '1', '%' ); ?>
</div>
<div class="clear" style="clear:both;"></div>
</div>
</div>
</li>
<?php endwhile; ?>
I dont say every post has 1MB. I just give example. For now, loading home page gets 50% more time because sidebars load whole content of posts what is pointless and I want to change this without heavy recoding of plugin.
Also as you can see, there is 'showposts => 3' but there are 6 boxes with posts with other categories so it gives total of 18 posts to load.
I want to remove line with the_content(); because it only shows one sentence and its not worth to load whole post content.