• Hi,

    Have installed PHP Exec v1.3 and it works (basic PHP commands).

    I’d like to post a “page” containing the loop but limited to only one category.

    Problem is, the loop just spits out “Sorry, but you are looking for something that isn’t here.”

    Any help would be appreciated.

    In the page is the following code:
    <phpcode>
    <h1>Latest News</h1>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="blogentry">
    .
    .
    . Usual blog entry, stats & trackback stuff
    .
    .
    </div>
    <?php endwhile; ?>
    <?php else : ?>
    <h2 class="center">Not Found</h2>
    <p class="center"><?php _e("Sorry, but you are looking for something that isn't here."); ?>

    <?php include (TEMPLATEPATH . "/searchform.php"); ?>
    <?php endif; ?>
    </phpcode>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The Loop requires setup that’s performed by the index.php and the wp-blog-header.php acting in concert to go from a query string to a set of posts. Just invoking a “have_posts()” kind of thing doesn’t provide all of this underpinning.

    You might try one of the customizable post listing plugins like the coffe2code one. Google search for “coffee2code customizable post listing” and you should see something… I’m too tired to do it :).

    Before calling have_posts() you need to actually query some posts. To query for all posts in category 1:

    query_posts('cat=1');

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WP1.5 PHP Exec – including a loop in a page’ is closed to new replies.