Theme formatting problem
-
Sorry for my third post in less than 24 hours all in the same section however my previous posts haven’t been answered and I have found no way of deleting my previous posts so my apologies for bombing this forum. However I have this issue that will resolve all my previous post I have a archive.php file that contains the following code
<?php get_header(); rewind_posts(); ?> <div class="archive"> <?php query_posts($query_string.'&posts_per_page=24'); if (have_posts()) : ?> <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php /* If this is a category archive */ if (is_category()) { ?> <h6></h6> <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> <h6>Posts Tagged ‘<?php single_tag_title(); ?>’</h6> <?php /* If this is a daily archive */ } elseif (is_day()) { ?> <h6>Archive for <?php the_time('F jS, Y'); ?></h6> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <h6>Archive for <?php the_time('F, Y'); ?></h6> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <h6>Archive for <?php the_time('Y'); ?></h6> <?php /* If this is an author archive */ } elseif (is_author()) { ?> <h6>Author Archive</h6> <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <h6>Blog Archives</h6> <?php } ?> <div class="clear"></div> <?php $i = 0; ?> <?php while (have_posts()) : the_post(); $i++; ?> <div class="span-8 post-<?php the_ID(); ?><?php if ($i == 3) { ?> last<?php } ?>"> <h6 class="archive-header"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title() ?></a></h6> <?php the_excerpt(); ?> <p class="postmetadata"><?php the_time( get_option( 'date_format' ) ); ?> | <?php comments_popup_link('Comments »', '1 Comment »', '% Comments »'); ?></p> </div> <?php if ($i == 3) { ?><div class="archive-stack clear"></div><?php $i = 0; } ?> <?php endwhile; ?> <div class="clear"></div>
this code returns a wonderful three column layout that I truly love. I am using a page to return all the post from particular categories in order for my theme to work properly with my use. The page I am using to return the category posts has a php template with the following code
<?php /* Template Name: Insight */ get_header(); ?> <div class="archive"> <?php if (is_page() ) { $category = get_post_meta($posts[0]->ID, 'category', true); } if ($category) { $cat = get_cat_ID($category); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $post_per_page = 24; // -1 shows all posts $do_not_show_stickies = 1; // 0 to show stickies $args=array( 'category__in' => array($cat), 'orderby' => 'date', 'order' => 'DESC', 'paged' => $paged, 'posts_per_page' => $post_per_page, 'caller_get_posts' => $do_not_show_stickies ); $temp = $wp_query; // assign orginal query to temp variable for later use $wp_query = null; $wp_query = new WP_Query($args); if( have_posts() ) : while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h6 class="archive-header"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title() ?></a></h6> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry »'); ?> </div> <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php get_search_form(); ?> <?php endif; $wp_query = $temp; //reset back to original query } // if ($category) ?> </div> <?php get_template_part( 'bottom' ); ?> <?php get_footer(); ?>
However this returns all of my posts from that category in a single line with no columns. I have managed to get things to go into a broken 2 column format. I was hoping someone could point me in the right direction on how to get this page to return a the same three column layout.
Thanks again.
- The topic ‘Theme formatting problem’ is closed to new replies.