Jump to content
Sign in to follow this  
rb415

Wordpress Post / Portfolio to randomize images.

Recommended Posts

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>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  



×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.