wordpress monthly navigation

Date: 25th October 2007 at 4:11 pm | Filed under: development, scripts, wordpress | Author: Sam Burdge

This article explains how to create a monthly navigation system for one or more categories in wordpress, or on the home page itself. By this I mean that on the first page it would display only posts from the current month. The next and previous page links would be replaced by next and previous month links.

To display the monthly content it is first necessary to create a custom query. This should be done before the loop begins. Here is an example of the custom query php:
Read on…

4 Responses to “wordpress monthly navigation”

  • Comment by hanslukas
    Date: May 12th, 2008 at 11:09 pm

    hi…
    it’s just what i was searching…

    I tried to use your solution pasting it on mi index.php, but don’t work…
    where my error please?

    Sorry for my english,I thank you
    regards

  • Comment by Minmin
    Date: November 27th, 2008 at 7:38 pm

    Thanks so much! You’re the best! :) It helped me so much.

  • Comment by Jack
    Date: March 24th, 2010 at 8:49 am

    Could you make this into a plugin? I’m looking for this for ages, using an old next/previous month plugin which works, but not with permalinks enabled. This is a link to that old plugin.

  • Comment by Weekly Links #13. | claudio schwarz – c.schwarz – claudioschwarz.com
    Date: March 25th, 2010 at 9:02 am

    [...] WordPress Montly Navigation Anstelle von Seite 1, 2 oder 3 (etc.) stünde bei dieser Programmierung ein Link zum vorherigen Monat. [...]

Leave a Comment

wordpress post navigation hacks

Date: 24th October 2007 at 2:34 pm | Filed under: development, scripts, wordpress | Author: Sam Burdge

This article covers using the global parameter $paged and the query $wp_query->max_num_pages; to create custom navigation links for previous and next posts. For some reason wordpress treats posts in the past as "next" and posts in the future as "previous" as explained in this exerpt from the WordPress website:
Read on…

5 Responses to “wordpress post navigation hacks”

  • Comment by gus
    Date: October 30th, 2008 at 1:18 pm

    Thanks for this interesting technique. I finally realized, though, that this works only for “paged” templates, like the index and categories and tag pages. Can you suggest a technique to use on single-post templates?

    I understand that some of this functionality is built in to the next_post_link and previous_post_link tags already, but it is still difficult to make one of them go away if you are using them with nested divs or other complicated bits of CSS — because you don’t have direct access to the anchor tag. Any suggestions for crafting an equivalent “if” statement that will make the previous or next link not show when not needed on a single-post page?

    Also, how much of a performance hit will the $wp_query call cause in the above code?

  • Comment by Sam Burdge
    Date: October 30th, 2008 at 11:34 pm

    Hi Gus

    With the next_post_link / previous_post_link functions you should use the ‘format’ parameter to keep your divs from displaying when the link is not needed. For example:


    <div id="post_nav">
    < ?php next_post_link('%link', 'Next Post'); ?>
    </div>

    will still display the div. While:


    < ?php
    $post_link_format='<div id="post_nav">%link</div>’;
    next_post_link($post_link_format, ‘Next Post’); ?>

    would only show the div when the link is needed.

  • Comment by Philip Arthur Moore
    Date: December 1st, 2008 at 12:17 pm

    Excellent writeup. Another suggestion: if you’re looking for a quick way to fade out elements that are disabled, consider adding a class to your disabled links (i.e. “.disabled”) and then controlling the functionality with jQuery (i.e. jQuery(”a.disabled”).fadeTo(”fast”, .2).removeAttr(”href”);). Thanks a ton.

  • Comment by Rumait
    Date: August 5th, 2009 at 1:51 pm

    where these changes will be made, i mean in which file, cofig.php or single post.php etc

  • Comment by sagive
    Date: August 28th, 2010 at 10:07 am

    do you have a solution that shows page number
    offering a direct navigation to the fifth, sixth page?

Leave a Comment

lazersonic

Date: 10th October 2007 at 8:00 pm | Filed under: portfolio | Author: Sam Burdge

I built this site for Lazer, dj / producer / remixer. The main focus for the site was for Lazer to be able to share his music, videos and live gig dates with his fanbase, updating the site regularly.

Lazer Title PageLazer BlogLazer Music Player

The lazersonic site is based on a hi-tech custom wordpress theme. It features a Flash enter page with a cool multi-coloured trail effect, using a repeat pattern of lazer's logo. The music player is a re-skinned version of the xspf Player using the xspf player plugin for wordpress.

visit the site: www.lazersonic.com

Leave a Comment