Forums

Previous and next links not working (9 posts)

  1. Jack Tummers
    Member
    Posted 2 years ago #

    When I choose a month my site will navigate to
    www.mydomain.com/2010/02

    On that page I have this code:

    if (is_date()) {
    next_posts_link('« older', 0);
    echo " | ";
    previous_posts_link('newer »', 0);
    }

    but this results in nothing. No links.

    What am I doing wrong? I'm using permalinks by the way, and what I really want is a monthly navigation, but that doesn't seem to exist (with permalinks)

  2. Jonas Grumby
    Member
    Posted 2 years ago #

    When you say "On that page I have this code" what are you referring to as "that page"? A date-based archive would use date.php, archive.php, or index.php in that order depending on which one(s) exist in your theme.

    Also, I assume you know that your code has to be between <?php and ?> tags.

  3. Jack Tummers
    Member
    Posted 2 years ago #

    I'm sorry. The code is on the index.php and between the php tags. :)

    I'm looking for a way to get navigation working on monthly archive pages. Best would be to have navigation to next and previous month, but the only plugin that does this does not work with permalinks. So nex_posts_link() is my best option for now.

    Any idea why this is not working?

  4. Jack Tummers
    Member
    Posted 2 years ago #

    Has no one else an idea why this function isn't working like the way I want it to?

  5. Harrison O.
    Member
    Posted 2 years ago #

    Hey moxie,
    As SS_Minnow mentioned. Basically, the URL http://www.domain. com/2010/02 will use one of the following files and order of importance.
    It will look first for date.php (if it doesn't exist)
    Look for archive.php (if doesn't exist)(most themes have this file)
    Look for index.php

    Therefore, if those files exist, make sure you have that code on them as well.

  6. Jack Tummers
    Member
    Posted 2 years ago #

    I have.
    I don't have a date.php or archive.php, just index.php and within that file this code:

    if (is_date()) {
    
    next_posts_link('&laquo; ouder', 0);
    
    echo " | ";
    
    previous_posts_link('nieuwer &raquo;', 0);
    
    }
  7. Jack Tummers
    Member
    Posted 2 years ago #

    I found out that the custom-posts-per-page plugin prevented the links to work because I set the number of posts per page for months at 100.

    Still... I'm looking for a way to navigate directly between months:

    << december - JANUARI - february >>

    There is no plugin that can do that with permalinks enabled :(

  8. Shane G.
    Member
    Posted 2 years ago #

  9. Jack Tummers
    Member
    Posted 2 years ago #

    I'm sorry, but I don't see how this plugin could help me with the kind of navigation I want. Simply next and previous month isn't possible as far as I can see.

Topic Closed

This topic has been closed to new replies.

About this Topic