WordPress.org

Support

Support » How-To and Troubleshooting » Displaying pages as posts

Displaying pages as posts

  • 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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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;
    }
    ?>

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying pages as posts’ is closed to new replies.