Trouble creating a custom archive page
-
Hi there,
I’ve set up a template to display posts from two separate categories on a single page (using post thumbnails). I’m half way there but I’m a bit of a novice with php and something’s not right.
Would anyone be able to help? Here’s what I’ve got in my template (catalogue.php):
<? php /* Template Name: Catalogue */ ?> <?php get_header(); rewind_posts(); ?> <div class="span-24 first last"> <div class="content"> <?php query_posts($query_string.'&posts_per_page=100'); if (have_posts()) : ?> <h4>Publications</h4><hr/> <div class="span-8<?php if ($archive == 5) { ?> last<?php } ?>"> <?php $featured == 0; $my_query_args = array ( 'cat' => 19, //'showposts' => $is_sticky_count, //'offset' => $is_sticky_check, 'showposts' => 50, 'offset' => 0 ); $my_blog_query = new WP_Query($my_query_args); while ($my_blog_query->have_posts()) : $my_blog_query->the_post(); $featured++; /*if ( is_sticky() ) continue*/; ?> <div class="post-<?php the_ID(); ?> portfolio-image-wrapper"> <?php get_the_image( array( 'custom_key' => array( 'thumbnail-160x160' ), 'default_size' => '160x160', 'width' => '160', 'height' => '160', 'image_class' => 'thumbnail-160x160' ) ); ?> <!-- <div class="category-overlay"><?php if (the_category(', ')) the_category(); ?></div> --> <h6 class="title-overlay"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title() ?></a></h6> </div> </div> <?php if ($archive == 5) { ?><div class="clear"></div><?php $archive = 0; } ?> <?php endwhile; ?> <h4>Tapes</h4> <hr/> <div class="span-8<?php if ($archive == 5) { ?> last<?php } ?>"> <?php $featured == 0; $my_query_args = array ( 'cat' => 21, //'showposts' => $is_sticky_count, //'offset' => $is_sticky_check, 'showposts' => 50, 'offset' => 0 ); $my_blog_query = new WP_Query($my_query_args); while ($my_blog_query->have_posts()) : $my_blog_query->the_post(); $featured++; /*if ( is_sticky() ) continue*/; ?> <div class="post-<?php the_ID(); ?> portfolio-image-wrapper"> <?php get_the_image( array( 'custom_key' => array( 'thumbnail-160x160' ), 'default_size' => '160x160', 'width' => '160', 'height' => '160', 'image_class' => 'thumbnail-160x160' ) ); ?> <!-- <div class="category-overlay"><?php if (the_category(', ')) the_category(); ?></div> --> <h6 class="title-overlay"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title() ?></a></h6> </div> </div> <?php if ($archive == 5) { ?><div class="clear"></div><?php $archive = 0; } ?> <?php endwhile; ?> <div class="clear"></div> <?php else : ?> <?php endif; ?> </div> </div> </div> <!-- Begin Footer --> <?php get_footer(); ?>
A bit of a mess eh?
The main problem I’m having is the background (content or span 24) isn’t cascading properly – the thumbnails don’t seem to be attached to it. And also the post titles aren’t showing up underneath the thumbnails. I’ve just pieced the above bit of code from the codex and other files from my theme.
The page in question is: https://www.mydancetheskull.com/catalogue/
The website is under maintenance mode but you can log in using these details to see it:
Username: guest
Password: guestThanks in advance to anyone willing to help.
Jordan
- The topic ‘Trouble creating a custom archive page’ is closed to new replies.