I have 8 post types in wordpress and have the following query in functions.php
file 8 times
So will it put load on mysql and decrease load times?
// random jokes
function randJokes($rJokes){
$RandJokesQuery = new WP_Query(array('post_type'=>'jokes','posts_per_page'=>$rJokes,'orderby'=>'rand')); ?>
<h2 class="title">Random Jokes</h2>
<ul>
<?php while ($RandJokesQuery->have_posts()) : $RandJokesQuery->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php if(function_exists('short_title')) { short_title(90); } ?></a></li>
<?php endwhile; ?>
</ul><?php
wp_reset_postdata();
}