WordPress.org

Ready to get started?Download WordPress

Forums

The Loop on Custom Page? (2 posts)

  1. ericdfields
    Member
    Posted 7 years ago #

    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; ?>
    '

  2. Chris_K
    Member
    Posted 7 years ago #

    You have something like this on that page?

    <?php
    define('WP_USE_THEMES', false);
    require('./wordpress/wp-blog-header.php');
    get_header();
    ?>

    Creating_a_Static_Front_Page

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags