How to alter query so that image changes in order every time page is refreshed

I’m trying to figure out whcich is best way to alter query so that image changes everytime page is refreshed.

The query is ordered by ‘rand’ at the moment and the code looks like this:

$settings=array( ‘post_type’ => ‘banner-up’, ‘numberposts’ => 1, ‘orderby’ => ‘rand’ );

query_posts( $settings);

if ( have_posts() ) : the_post();

$spacing=apply_filters(‘the_content’,get_the_content());

echo ‘<div class=”top banner”>’.$spacing.'</div><!–banner–>’;

endif; wp_reset_query();

I’m pretty bad at PHP and coding overall so would be grateful if anyone could tell me some tips for that what would be the best way to execute an alternating query. Thank you in advance!

Read more here:: How to alter query so that image changes in order every time page is refreshed

Leave a Reply

Your email address will not be published. Required fields are marked *