WordPress.org

Ready to get started?Download WordPress

Forums

next_posts_link outside main wordpress install (1 post)

  1. voiddesign
    Member
    Posted 2 years ago #

    hello wordpress geniuses,

    can't for the life of me figure out how to get this to work. in english, here's what i'd like to do:
    -query all posts in one category
    -display only one post
    -create previous/next links that shift from post to post within the category.
    link to the website: http://nhkw.net/testnext.php

    the code i have:

    <?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    include('updates/wp-load.php');
    query_posts( array ( 'cat=5', 'posts_per_page' => 1 ) );
    ?>
    ...
    <?php while (have_posts()) : the_post(); ?>
    <h1>
    <?php the_title(); ?>
    </h1>
    <h2>
       <?php echo get_the_date( 'j F Y' ); ?>
    </h2>
    <h3>
    <?php the_content(); ?>
    </h3>
    <?php endwhile; ?>

    <?php previous_post_link('%link','%title'); ?>
    <?php next_post_link('• %link','%title'); ?>

    as you can see, the link just spits out a literal link, which doesn't exist since i'm not really "inside" a wordpress install, i'm just sucking data out.

    would the best way to do this be to make a function that concatenates a new $query_string each time and then reload the page with the new query?

    i just KNOW there's a stupidly easy way to do this that i can't figure out. any and all help/advice/chiding appreciated.
    -sam

Topic Closed

This topic has been closed to new replies.

About this Topic