WordPress.org

Ready to get started?Download WordPress

Forums

Displaying pages as posts (3 posts)

  1. WarAxe
    Member
    Posted 8 years ago #

    Okay... masters of WP gimme some love! I want to list a set of pages as if they were posts. I want to lay down some code as shown below:

    '
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <!-- put display code here -->
    <?php endwhile; ?>
    <?php else : ?>
    <?php endif; ?>
    '

    ...and have it list out a set of pages. How do I isolate my post query so that have_posts() will return a given set of pages?

  2. Tijmen
    Member
    Posted 8 years ago #

    This kind of does the trick...

    <?php
    $x = @mysql_query("SELECT ID, post_title, post_content FROM wp_posts WHERE post_status='static'");

    while ($row = mysql_fetch_array($x)) {
    $title = $row["post_title"];
    $content = $row["post_content"];

    echo $title;
    echo $content;
    }
    ?>

  3. WarAxe
    Member
    Posted 8 years ago #

    Yeah, something like that. Thanks, Tijmen. Actually, that's really quite simple, isn't it? We'll see what I come up with to spruce(sp) it up.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags