Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Individual loop count with divs & pagination
<!-- Begin Custom Fields -->
<?php
if ( have_posts() )
{ /* Query and display the parent. */
while ( have_posts() )
{
the_post();
$count = 1;
$thispage=$post->ID;
}
}
?>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$childpages = query_posts('paged=' . $paged . 'orderby=menu_order&posts_per_page=3&order=asc&post_type=page&post_parent='.$thispage);
if($childpages){ /* display the children content */
$counter = 1;
foreach ($childpages as $post) :
setup_postdata($post);
if ($counter % 2 == 0) {
?>
<!-- Begin First Section -->
<div id="section2">
<div class="container">
<div class="template-page content av-content-full alpha units" style="border:none;">
<div class="flex_column av_two_third first avia-builder-el-1 el_before_av_one_third avia-builder-el-first ">
<div class="TeamText" style="min-height:300px;">
<h2 style="margin-bottom: 20px;"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p>
Client: <?php the_field('client'); ?><BR>
Industry: <?php the_field('industry'); ?><BR>
Category: <?php the_field('category'); ?><BR><BR>
<p><?php the_field('excerpt')?></p>
<a href="<?php the_permalink(); ?>"><div class="FindOutMoreButtonGreen">Read more </a></div>
</div>
</div>
<div class="flex_column av_one_third avia-builder-el-5 el_after_av_two_third avia-builder-el-last ">
<section class="av_textblock_section" itemscope="itemscope" itemtype="https://schema.org/CreativeWork">
<div class="avia_textblock " itemprop="text">
<div class="avia-image-container av-styling- avia-builder-el-6 avia-builder-el-no-sibling avia-align-center " itemscope="itemscope" itemtype="https://schema.org/ImageObject">
<div class="avia-image-container-inner">
<img src="http://uprisetestdomain.co.uk/Evosoft/wp-content/uploads/2015/01/am.png" class="avia_image " alt="">
</div>
</div>
</div>
</section>
</div>
</div>
</div>
</div>
<!-- End First Section -->
<?php
}
else
{
?>
<!-- Begin Second Section -->
<div id="section1">
<div class="container">
<div class="template-page content av-content-full alpha units" style="border:none;">
<div class="flex_column av_two_third first avia-builder-el-1 el_before_av_one_third avia-builder-el-first ">
<div class="TeamText" style="min-height:300px;">
<h2 style="margin-bottom: 20px;"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p>
Client: <?php the_field('client'); ?><BR>
Industry: <?php the_field('industry'); ?><BR>
Category: <?php the_field('category'); ?><BR><BR>
<?php the_field('excerpt')?></p>
<a href="<?php the_permalink(); ?>"><div class="FindOutMoreButtonGreen">Read more </a></div>
</div>
</div>
<div class="flex_column av_one_third avia-builder-el-5 el_after_av_two_third avia-builder-el-last ">
<section class="av_textblock_section" itemscope="itemscope" itemtype="https://schema.org/CreativeWork">
<div class="avia_textblock " itemprop="text">
<div class="avia-image-container av-styling- avia-builder-el-6 avia-builder-el-no-sibling avia-align-center " itemscope="itemscope" itemtype="https://schema.org/ImageObject">
<div class="avia-image-container-inner">
<img src="http://uprisetestdomain.co.uk/Evosoft/wp-content/uploads/2015/01/am.png" class="avia_image " alt="">
</div>
</div>
</div>
</section>
</div>
</div>
</div>
</div>
<!-- End Second Section -->
<!-- Begin Pagination -->
<nav class="pagination">
<div class="container">
<?php pagination_bar(); ?>
</div>
</nav>
<!-- End Pagination -->
<?php
}
$counter += 1;
?>
<?php
endforeach;
} ?>
<!-- End Custom Fields -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.