vendredi 27 février 2015

Display Wordpress Post Thumnails with Horizontal Scrolling

Dear StackOverflow I'm having some problems with displaying wordpress post thumbnails as per the image below. I've create a one page template that has queries for each post type I want to show but one of them I'd like to have horizontally with a show more/less buttons depending on how many are remaining. I presume I need to put these in to seperate divs then Jquery to scroll the divs but I'm quite lost. The image below should explain it a little better.


Suggested Layout Obviously the sections to the right would be hidden until required to scroll in and replace current images.


I'm open to all suggestions of showing/replacing the view but a set number of items only at a time... at the moment, 7.


Below is the relevant section code so far which isn't correct but its as close as I can get it just now.



<section id="releases" class="content" >
<?php
$args = array(
'post_type' => 'releases',
'post_status' => 'publish'
);
$query = new WP_Query($args);

//
$first = 7;
$next = 6;
?>

<?php if($query->have_posts()): ?>
<div class="slide">
<?php while($query->have_posts()) : $query->the_post(); ?>
<div class="release col-3 left">
<?php the_post_thumbnail(); ?>
</div>
<?php $current_position = $query->current_post + 1; ?>
<?php if ($current_position < $query->found_posts && $current_position % $first == 0) : ?>
<!-- -->
<div class="release col-3 left">
SHOWMORE</div>
<div class="clear"></div>
</div><div class="slide">

<?php endif; ?>
<?php endwhile; ?>
</div>
<?php endif; ?>
</section>


Thank you for any help you may give me.


Aucun commentaire:

Enregistrer un commentaire