Not sure whether this one has been covered before - I certainly couldn't find anything relevant.
I am developing a fairly decent sized photography site which utilises a few different custom post types. The traffic of the current site is small at a few thousand visits a month.
The site is running on Genesis and my child theme is a completely custom theme.
Here is my basic query:
<?php
$args = array( 'post_type' => 'venues', 'orderby' => 'menu_order', 'order' => 'ASC');
$loop = new WP_Query( $args );
if( $loop->have_posts() ):
while( $loop->have_posts() ): $loop->the_post(); global $post;
?>
<a href="<?php echo get_permalink();?>">
<h3 itemprop="headline"><?php echo get_the_title(); ?></h3>
</a>
<p itemprop="description"><?php the_excerpt() ?></p>
<?php
endwhile;
endif;
?>
The WP_Query is exactly as I have although the HTML that gets the title and the excerpt differs slightly.
The site loads at decent speed - around 800ms on the archive page with 18 posts, each containing a thumbnail of around 200kb.
My server is a VPS running 2GB RAM, Centos with Apache, PHP 5.5 FPM and Varnish. The site is running a PHP limit of 125MB, W3 Total Cache and 4 other minimal plugins (Yoast SEO, Ithemes security, ACF and Ninja Forms) so it's not a particularly heavy install IMO. The server is also running around 7 other light weight WP installs.
My question is - can I optimise the custom post type query to make it more efficient? The archive page only displays the post title, an advance custom field showing an image and the excerpt of the post.
I have seen blogs about using get_post and bypassing the caching to help increase performance but I didn't really notice any difference.
I know the site isn't very slow in comparison to other sites and the child theme is very lean indeed (I have optimisation OCD!) but I just wonder whether I can optimise the query any more.
Thanks in advance, D