Homepage Query Loops
-
I am currently having a severe problem with my home page on wordpress…
I have set the homepage to a static page (Home.php) and I have edited the template to show the latest 4 posts from a catergory but I also want it to display the content that I have specified in the backend on the page ‘Home’.
The problem I am having is the fact I have specified the code to show posts from a catergory first the actual loop to bring in the content from the backend is actually just displaying content from the catergory instead. Here is the code I am using:
<?php /** * @package WordPress * @subpackage Default_Theme */ /* Template Name: Home */ ?> <?php get_header(); ?> <div id="featuredcontent"> <?php include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php'); ?> <?php query_posts("showposts=4&category_name=Portfolio"); $i = 1; ?> <?php while (have_posts()) : the_post(); ?> <div class="featureportfolio<?php echo $i++;?>"> <?php $values = get_post_custom_values("thumb"); if (isset($values[0])) { ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> <img src="<?php $values = get_post_custom_values("thumb"); echo $values[0]; ?>" alt="<?php the_title(); ?>" class="left" width="200px" height="81px" style="border-bottom:9px solid #8bc200" /></a> <?php } ?> <div class="info"> <strong><?php the_title(); ?></strong><br /> <?php the_content_limit(160, "[Read full case study]"); ?> </div> </div> <?php endwhile; ?> </div> <div id="content" class="narrowcolumn" role="main"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <div class="entry"> <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> </div> </div> <?php endwhile; endif; ?> <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> <?php comments_template(); ?> </div> <?php get_footer(); ?>
Does anyone know how to stop the loop from the catergory and restart the original loop – is there anyway I can specify the page id on the second loop?
- The topic ‘Homepage Query Loops’ is closed to new replies.