Adding query_post to static page template
-
I’d like to create a page template that uses a category to display the same information (post) in a hero space, while the content beneath changes.
Example: Every product page has the same hero space, same text, same image. But each product needs to different information below the hero space.
I tried adding this code in a hero space div above the main loop on my page template.
` <?php query_posts(‘cat=10’); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<div id=”post-<?php the_ID(); ?>” <?php if(function_exists(‘post_class’)) : post_class(); else : echo ‘class=”post”‘; endif; ?>><?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>I know I can use query_posts below the above code to call the page id I want for a specific product page. But i need for people to add more product pages without editing the template every time.
The topic ‘Adding query_post to static page template’ is closed to new replies.