WordPress.org

Support

Support » Themes and Templates » The Loop on Custom Page?

The Loop on Custom Page?

  • Is it actually possible to run a loop on a custom page? I’ve tried putting the following code on a Page template, but that page doesn’t spit out the posts as I hoped it would. Is there anything wrong with the following?


    '
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <!-- <h2>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2> --> <h3><?php the_title(); ?></h3>
    <h3 class="title">Updated <?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></h3>

    <div class="entry">
    <?php the_content(); ?>
    </div>

    <!-- <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> -->
    </div>

    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Next 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.
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>

    <?php endif; ?>
    '

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘The Loop on Custom Page?’ is closed to new replies.
Skip to toolbar