• Resolved gdallen

    (@gdallen)


    I’ve created an output page for cellular phones or PDAs that spits out only the date, heading and topic text. In the file that creates the special page, I want to set the posts_per_page variable to just five posts, instead of the 15 that I’ve set for the full Web site page. But apparently the variable is set within the display loop, so setting it before the loop doesn’t seem to work. How can I set the posts_per_pay and what_to_show variables outside the loop and get it to work?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can use the query_posts template tag.

    Thread Starter gdallen

    (@gdallen)

    Thanks for the tip, and I’ve created a text-only Web page for low-bandwidth, usually portable devices that displays just the unformatted text of my Web site, and only the first seven items. Here’s the code in a file I named “mobile.php” and placed in the same folder as the main index.php file:

    <?require(‘wp-blog-header.php’);?>
    <?php query_posts(‘posts_per_page=7&&what_to_show=posts’); ?>
    <?php if (have_posts()) : ?>
    * MyWebSiteName *<br><br>
    <?php while (have_posts()) : the_post(); ?>
    <?php the_date(‘M j, \’y’) ?><br>
    <?php the_title(); ?>
    <?php the_content(‘more »’); ?>
    <?php endwhile; ?>
    <?php endif; ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Topic Output for PDA/Cellular’ is closed to new replies.