I have been working on a custom archive page but I have run into some trouble. The pagination is shifting down into the footer area.
I have gone through my code several times and I cannot work out why this is happening. If I remove the loop, the template works correctly.
With the loop in place, the pagination shifts down to the footer and takes any coding below it (in the archive page) with it.
The archive page coding is:
<?php get_header(); ?>
<main role="main">
<section class="commissions">
<div class="commissions-section-one">
<h1>Commissions</h1>
<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('commissions-intro')) ?>
</div>
<?php get_template_part('single-commissions'); ?>
<?php get_template_part('pagination'); ?>
</section><!-- /section -->
</main><!--/ Main -->
<?php get_footer(); ?>
The custom loop code is:
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
<div class="commission-wrapper">
<div class="commission-inner cf">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="commission-content-wrapper">
<div class="commission-content-inner">
<img src="<?php the_field('commissions-company-logo'); ?>" />
<h2 class="company-author"><?php the_title(); ?></h2>
<p class="company-location"><?php the_field('commissions-company-location'); ?></p>
<p class="company-description"><?php the_field('commissions-company-description'); ?></p>
<p class="company-date"><?php the_field('commissions-company-date'); ?></p>
<?php echo do_shortcode("[indeed-social-media sm_list='fb,tw,goo,li' sm_template='ism_template_10' sm_list_align='horizontal' sm_display_counts='false' sm_display_full_name='false ]");?>
</div><!--/ Commission Content Inner -->
</div><!--/ Commission Content Wrapper -->
</article><!--/ Article -->
<div class="commission-images">
<div class="row first cf">
<div class="left-column" style="background-image:url(<?php the_field('commissions-image-one'); ?>);"></div>
<div class="right-column" style="background-image:url(<?php the_field('commissions-image-two'); ?>);"></div>
</div><!--/ Row -->
<div class="row cf">
<div class="left-column" style="background-image:url(<?php the_field('commissions-image-three'); ?>);"></div>
<div class="right-column" style="background-image:url(<?php the_field('commissions-image-four'); ?>);"></div>
</div><!--/ Row -->
</div><!--/ Commission Images -->
</div><!--/ Commission Inner -->
</div><!--/ Commission Wrapper -->
<?php endwhile; ?>
<?php else: ?>
<!-- article -->
<article>
<h1><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h1>
</article>
<!-- /article -->
<?php endif; ?>
<?php get_footer(); ?>
I am using the HTML 5 blank theme and haven’t added anything additional in regards to pagination.
I’m not sure what you’re doing with this line…
…since you’re not outputting anything. I’d either get rid of it, or fix it so that it’s a valid conditional (with an
endif;
).It also looks like you’re calling
get_footer()
twice…