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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

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.