Jump to content


Photo

Wordpress Post / Portfolio to randomize images.


  • Please log in to reply
No replies to this topic

#1 rb415

rb415
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 01 February 2017 - 11:41 PM

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>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users