• Resolved goldmember

    (@goldmember)


    on this page i’m using the code below to show the 25 most recent posts from category 4.

    <?php
    $custom_query = new WP_Query( 'posts_per_page=25&cat=4' );
    if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>
    
    <h3><?php the_title(); ?></h3>
    <h6><?php the_time('F j, Y') ?></h6>
    <?php the_content(); ?>
    <hr class="homenews" />
    <?php previous_posts_link('? Older Entries', 0) ?>
    <?php endwhile; else : ?>
    
    <h3>Sorry...</h3>
    <p>No posts were found.</p>
    
    <?php endif; ?>

    i thought this line of code <?php previous_posts_link('? Older Entries', 0) ?> would add a link to the bottom of the page that shows a link to previous entries but for some reason the link does not appear.

    please advise how I can get it to show. thanks in advance

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

    (@vtxyzzy)

    I think you need to use query_posts() instead of WP_Query and add the ‘paged’ argument to the query.

    Thread Starter goldmember

    (@goldmember)

    based on what i read in another thread where they addressed this same issue, I would think the code below would work.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    but if you look on the page where i’m testing this code, i’m getting a parse error message.

    please advise. thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP_Query help’ is closed to new replies.