Help with query_posts
-
Hello,
I am trying to create a home page in which there is block of text at the beginning. This block of text should display the content of a specific page. The rest of the home page should display as usual. For example:
+--------------------------------------------+ | HEADER | +--------------------------------------------+ | block of text | | displays content of page_id = 8 | +--------------------------------------------+ | index.php | | displays rest of the posts | | as an out-of-the-box | | install | +--------------------------------------------+ | footer | +--------------------------------------------+
Im am using this in the block of text to display page_id 8 content:
<?php query_posts($query_string . "&page_id=8"); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="entry"> <?php the_content('<p class="serif">Leer más » '); ?> </div> <?php endwhile; endif; ?> <?php rewind_posts(); ?>
and then, in index:
<?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> ...usual stuff... <?php endif; ?> <?php endwhile; ?>
This does not work because, even though page content is correctly shown in the block of text, page_id 8 content gets duplicated below, in the index section, and nothing else shows.
Any ideas how to do this ?
Thanks
- The topic ‘Help with query_posts’ is closed to new replies.