Using loop within custom template page
-
I am trying to use the following code in a custom template:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2 class="storytitle">..:: <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a> ::..</h2> <div class="meta"><?php _e("Posted at "); ?><?php the_date() ?> @ <?php the_time() ?> <div class="storycontent"> <?php the_content(__('(more...)')); ?> </div> </div> </div> <?php endwhile; else: ?> <?php endif; ?>
However it does not show any posts when I browse to a page that uses this template. Using the same code in index.php works fine – it shows the posts.
I have tried searching for solutions and while I didn’t find anything, I seem to recall having to use a custom query to get it to work? Im not sure…
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Using loop within custom template page’ is closed to new replies.