Hey again, Sorry to be such a pain but i’ve been at this for ages and i’m getting nowhere.
As i understand it you’re telling me i need to set a count like this to place a div around every three posts
I can’t seem to make this work so i’m inserting the template i’m using in the hope you can advise what i should be doing.
<?php
/**
* The template for displaying Archive pages.
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you’d like to further customize these archive views, you may create a
* new template file for each specific one. For example, Twenty Twelve already
* has tag.php for Tag archives, category.php for Category archives, and
* author.php for Author archives.
*
* Learn more: https://codex.www.ads-software.com/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<section id=”primary” class=”site-content”>
<div id=”content” role=”main”>
<?php
/* Display All Posts */
/* Display All Posts */
if ( have_posts() ) : ?>
<header class=”archive-header”>
<h1 class=”archive-title”></h1>
</header><!– .archive-header –>
<?php
global $query_string;
query_posts( $query_string . ‘&posts_per_page=-1’ );
$count = 0;
if(have_posts()) : while(have_posts()) : the_post();
if ($count < count($posts)) {
$open = !($count%2) ? ‘<div class=”work-row”>’ : ”;
$close = !($count%2) && $count ? ‘</div>’ : ”;
} else {
$open = ‘<div class=”work-row”>’;
$close = ”;
}
echo $close.$open;
?>
<div id=”posts”><article>
<h3 class=”entry-title”>“><?php the_title(); ?></h3>
<?php the_post_thumbnail(‘excerpt-thumbnail’); ?>
<div><?php the_excerpt(); ?></div>
<?php the_field( “affiliate”); ?><?php the_field( “more”); ?>
</article></div>
<?php
$count++;
endwhile; endif; ?>
<?php echo $count ? ‘</div>’ : ”;
twentytwelve_content_nav( ‘nav-below’ );
?>
<?php else : ?>
<?php get_template_part( ‘contented’, ‘none’ ); ?>
<?php endif; ?>
</div><!– #content –>
</section><!– #primary –>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Thanks in Advance