WordPress.org

Ready to get started?Download WordPress

Forums

CMS Frontpage w/ Traditional Blog/All-Posts-Listed Behind It (3 posts)

  1. KnockItOut
    Member
    Posted 6 years ago #

    Ok, I suck at this whole WP coding thing.

    I've done a search and don't see anything quite suitable for my situation (perhaps I'm using the wrong search terms) so here it goes..

    Here's my dilemma. Let's say that on my home page (frontpage, index, start page, whatever) I'm only listing a few posts in a CMS style. What I'd like to do is provide a link below the oldest post on the page that would take the visitor to the posts that were made prior to the ones on that main front page. I don't want to use the archive link because it sections off the posts into dates and/or categories. I'd like this additional page/section to look more like a traditional blog. Posts would be listed in descending order, at X number of posts per page, full or partial content would be visible (as well as some meta), with "Next"/"Previous" links at the bottom to allow the visitor to page through to the next X number of posts all the way back to the first post made.

    I've tried a number of variations, but not knowing the code very well, it makes finding a solution kind of random. At first I thought I could just take the code from a normal blog's index.php and make a page template out of it. But that code fails to pull any posts from within a page template. By dumb luck, I remedied this slightly by using this bit of code before the loop..

    <?php query_posts('posts_per_page=10'); ?>

    This called the post information into the template, it listed the 10 posts as it should, but when you try to click on the "Next" or "Previous" links, the same exact (most recent) ten posts are displayed. It doesn't allow you to access posts 11-20, or beyond. If I wanted to, I realize I could use "-1" as the variable and list every post created, but they'd all appear on that same one page. This might be quite unwieldy if perhaps there were 1000+ posts to list.

    So, I'd like to figure out how I can list posts & some of their content/meta, in descending order, broken into X posts per page, and allow navigation through the pages of previous posts.

    Any ideas?? This has to be possible, right? I'm betting that I'm making it much more difficult than it should be or looking past something very obvious.

    Any help whatsoever is greatly appreciated.

  2. KnockItOut
    Member
    Posted 6 years ago #

    Alright, here's the gist of what my code looks like. I'm sure it's total crap. See the above post for the problem I'm having and solution I'm seeking. Again this is inside a template page.

    Code:

    <?php query_posts('posts_per_page=10'); ?>
    
    <?php if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); the_content(); ?>
    
    <?php endwhile; ?>
    
    <?php next_posts_link('&laquo; Previous') ?> &nbsp;
    <?php previous_posts_link('Next &raquo;') ?>
    
    <?php endif; ?>
  3. KnockItOut
    Member
    Posted 6 years ago #

    Anyone??

Topic Closed

This topic has been closed to new replies.

About this Topic