in my single.php i have code that will show 6 random post as a ul
How can i add button that will refresh only my wp_query on click?
Here is my code:
<?php $random_post = new WP_query(); ?>
<?php $random_post->query('showposts=6&orderby=rand'); ?>
<?php while ($random_post->have_posts()) : $random_post->the_post(); ?>
<?php
if (has_post_thumbnail()) {
echo '<div class="small-index-thumbnail">';
echo '<li> <a href="' .
get_permalink() . '" title="' . __('Read: ', 'theme-zero') . get_the_title() . '" rel="bookmark">';
echo the_post_thumbnail('index-thumb');
echo get_post_meta($post->ID,'incr_number',true) . '. ';
echo the_title() . '</a></li></div>';
}
?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
Aucun commentaire:
Enregistrer un commentaire