• Resolved zachalbert

    (@zachalbert)


    My front page points to a static page which also calls a few recent blog posts. When I only had the single loop, posts_nav_link worked fine. Now, it doesn’t. I have found several people with the same question on this forum, but none of the solutions seem to work for me??? When I view the source, there is nothing between the div’s like so:

    <div class="navigation"> </div>

    And, the code:

    <?php $my_query = "showposts=3&category_name=news&paged=1"; $my_query = new WP_Query($my_query); ?>
    <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <?php global $more; ?>
    <?php $more = 0; ?>
    
    <div class="post" id="post-<?php the_ID(); ?>">
    
    <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    
    <div class="postdate">Posted on <?php the_time('l, M jS, Y'); ?></div>
    
    <div class="entry">
    <?php the_content('Read More...'); ?>
    </div>
    
    </div>
    <?php endwhile; ?>
    
    <!-- The page nav problem is below -->
    
    <div class="navigation">
    <?php posts_nav_link(); ?>
    </div>
    
    <?php endif; ?>
Viewing 5 replies - 1 through 5 (of 5 total)
  • It will not work on static Pages.

    Thread Starter zachalbert

    (@zachalbert)

    Ack! Sorry for the repost, I just got an error when posting it the first time.

    About the question, is there any way to achieve what I’m looking for? I’m not a super advanced WP user, but couldn’t I post an “older…” link which would link to a blog only page? That way, the posts_nav_link would work, yes?

    Thanks for the quick reply!

    I am not sure I can follow the logic. You have a static Page as your frontpage. Regardless of showing a few posts on it – there is no “previous posts navigation” because it is a Page, not a multipost view, like index, archives, search results etc.

    To show your whole blog – on the very same location where you selected the frontpage, select another (existing, empty) Page as your “posts page”. It will display all your posts, including the working next/prev links.

    Thread Starter zachalbert

    (@zachalbert)

    Okay I think I understand. The nav links won’t work because my homepage is a static page, not a posts page, right?

    But I ran into a new problem. So here’s what I did: I created a new page, with only a title of “Whatever.” Under the page template section of “Whatever,” I selected a different template from the static+posts page. The “Whatever” template has only a single loop calling for the posts and has the Template Name: section at the beginning of the php file.

    My static frontpage points to the page with static+3 posts. My “posts page” points to the page I created above. When I actually go to this page though, I doesn’t use the new template, but same template as the static+posts page. The only difference is it displays 3 posts with the first loop (just like the homepage) and all the posts with the second loop (whereas on the homepage it displays the static content).

    But I have checked and rechecked to make sure the “posts page” uses a different template in the dashboard. When I actually play with that file like adding or subtracting major sections, nothing happens. It’s like it can only use the default template that my homepage uses. How do I fix this?

    Thread Starter zachalbert

    (@zachalbert)

    Update: I solved the problem. I stupidly named one of my pages home.php, which I guess conflicts with something.

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

The topic ‘posts_nav_link not appearing’ is closed to new replies.