rb415 Posted February 1, 2017 Share Posted February 1, 2017 Hi everyone, I am having an issue with getting these posts to cycle through randomly each time the page is visited. I have some code that shows everything that I need to be seen but for some reason it only shows the 1st post. It never cycles any of the information. Any help with this would be greatly appreciated. Here is what my code looks like. <div class="partner-box-2"> <?php query_posts('post_type=portfolio&showposts=1&offset=0&orderby=rand'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h3>Partners</h3> <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <img style="padding-top:10px;" src="<?php the_field('company_productimage'); ?>" /> <div style="padding-top:10px;padding-bottom:10px;font-size:85%;line-height:120%;"> <?php the_field('company_summary'); ?> </div> <div align="center" class="smaller-button"><a style="color:#fff;text-decoration:none;" href="<?php the_permalink(); ?>" >More About <?php the_field('company_short_name'); ?></a></div> <?php endwhile; endif; ?> <?php wp_reset_query(); ?> </div> Quote Link to comment https://forums.phpfreaks.com/topic/303079-wordpress-post-portfolio-to-randomize-images/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.