• So basically I have two groups of authors (kids/parents) that are making posts. I have it set up so that posts from each group are showing up on separate pages. The problem comes with the navigation. When you click on newer/older post links and go to /page/2, etc the blog entry doesn’t change.

    The code I used to query only posts from specific authors (which I assume is where the problem lies) is:

    <?php query_posts(‘author=4,5,6,7,8’); ?>

    I put this up right after <?php get_header();?>. The rest is the normal blog post code.

    Where should I edit/add to to get the pages and navigation links to work properly? I still want to only show those authors and still only show one blog entry per page, but I want the pages to WORK.

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi

    change your query_posts code to this:
    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    query_posts(“author=4,5,6,7,8&paged=$paged”);

    the double quotes on the query_posts are necessary for this to work. This resolves the paging issue.

    Thread Starter chrisvallely

    (@chrisvallely)

    That worked perfectly, thanks sooo much!

    Hey, this is me (chrisvallely) again (apparently I have two wordpress accounts somehow). I had one more request before this is resolved. My parents (who I’m doing this site for) now want 2 posts to display on each page. I changed the Settings > Reading > “Blog pages show at most” to 2, but that only fixed the “homepage” blog (parents). The kids blog still only shows the most recent post from the kids and now skips the 2nd post when I go to next entry.

    Any ideas? I can post more of the code if it’s not in the same section that I need to change things. I tried adding &showposts=2 to the end of the query_posts, but that didn’t help things.

    Hi

    The &showsposts=2 should resolve the issue. Sounds like other code may be affecting the results. Post more code, yes.

    This post is so old now its buried on my posts list. If I don’t respond to your reply its because I didn’t see it. In that case its OK to send that reply to me by email – see my profile. If you do please reference this page’s URL in your email.

    Since I don’t know what portion of the code would be changing anything (I tried but couldn’t figure it out) Here’s a link to the code for the template page that I’m referring to:

    http://pastebin.com/m671996d7

    Now that I look at it, I wonder if I used the “single-post.php” file as a base for this one ’cause I don’t see the usual “wordpress loop”.. hmm I’ll look into that, but any insight is appreciated.

    I don’t see a while either. In which case you are only going to get one post.

    Thanks, I fixed it up, got it working. I replaced the:

    <?php if ($posts) {

    and

    foreach($posts as $post)
          {

    with the normal wordpress loop

    if ( have_posts() ) {

    and

    while ( have_posts() ) { the_post();

    and now it works perfectly. Thanks for all your help earlier!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Author group posts on separate pages’ is closed to new replies.