Suppose I am developing a minimal theme, the the post page single.php
displays only the post title, the excerpt and the content.
So in general that would be
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php the_content(); ?>
So I am expecting 3 queries...
Instead if I write a custom query where I am just fetching these 3 datas in an array at once...
<?php arr[] = get_row(select title, excerpt, content from wp_posts where post_id = 1); ?>
<?php echo arr[0] ?>
<?php echo arr[1] ?>
<?php echo arr[2] ?>
Which is faster or does it make a difference ?
Plz ignore syntax if wrong...
the_title()
,the_excerpt()
andthe_content()
. You should profile your theme to better see where the queries come from. Many good tools out there.