Hi everyone,
I need a bit of PHP help. I have created a wedding supplier directory website. I sent it off to be coded into a WordPress theme (I am more a designer than a coder!). All is great apart from one thing:
On one of the pages, there are multiple banner ads:
monaghanweddings.com/supplier-post-category/hotels-venues
I need to have the ads displaying randomly each time the page is landed on so that everyone who advertises on the site gets a chance to be at the top of the list.
I am really struggling with this and can't seem to figure out what to do. I can only find rotating banner scripts on the internet which displays one banner but loads a different image within it each time it is loaded so that is not exactly what I am looking for.
My WordPress file for this page lools like this:
If anyone can help me I would really appreciate it, I am tearing my hair out with this one!PHP Code:
<?php get_header('supplier'); ?>
<div id="two-columns" class="clearfix">
<?php $supplier_categories = wp_get_object_terms( get_the_ID(), 'supplier-post-category'); ?>
<div class="content-header">
<h2>
<?php
if($supplier_categories){
$pcat = array();
foreach($supplier_categories as $c){
$pcat[] = $c->name;
}
echo implode(', ',$pcat);
} ?>
</h2>
</div>
<div id="content">
<div id="supplier-directory-listing">
<ul>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<li>
<a target="_blank" href="<?php echo str_replace("\r", "", get_the_content('')); ?>">
<?php $attr['title'] = $attr['alt'] = get_the_title();
the_post_thumbnail('supplier-img', $attr );
?>
</a>
</li>
<?php endwhile; ?>
<?php endif; wp_reset_query();?>
</ul>
</div><!-- // end #supplier-directory-listing-->
</div>
<!-- // end #content -->
<?php get_sidebar('newcat'); ?>
</div>
<!-- // end #two-columns -->
<?php get_footer(); ?>
Thanks so much in advance.



Reply With Quote

Bookmarks