Previous Next Buttons for Category

Community Forums Forums Design Tips and Tricks Previous Next Buttons for Category

This topic is: not resolved

This topic contains 4 replies, has 4 voices, and was last updated by  Susan 1 year, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #49809

    Susan
    Moderator
    Post count: 8727

    I am working on a site for a client using the News theme. (www.demo.graphicallydesigning.com)

    For the Featured Tabbed Widget area, the client would like to have previous and next buttons leading from one post to the next in the same category, similar to those seen on this site:

    http://www.activebeat.com/diet-nutrition/20-foods-proven-to-boost-energy/2/

    Does anyone know of a plugin which would accomplish this, or can someone point me in the direction of a tutorial to accomplish this?

    Edited to add: I’ve seen the Genesis Post Navigation Plugin, but it doesn’t seem to work correctly (nor can I see how to modify the text – default is the post name):

    http://wordpress.org/support/plugin/genesis-post-navigation

    Thanks!


    Susan @ Graphically Designing I’d love to customize your website! I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

    http://www.demo.graphicallydesigning.com
    #49815

    braddalton
    Participant
    Post count: 9399

    If you only want the links to apply to posts in one category, you’ll need to use a conditional tag.

    Here’s 2 examples which you may need to tweak.

    Change the hook if needed.

    This uses HTML 5 hooks

    I think you could create those links manually using the next page tag

    http://codex.wordpress.org/Function_Reference/wp_link_pages


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #49817

    David Chu
    Participant
    Post count: 1355

    Hi,
    A couple related thoughts. I just tried that Genesis plugin. I had to hack it to get it to activate in Genesis 2 beta. :-) But no joy, it didn’t display anything anyway. So it’s a non-starter for Genesis 2, at least as it is now.

    I swapped back to Genesis 1.9, and it worked, and was, um, very springy upon mouseover. :-) But it didn’t give the center spot in your example telling where you were, so it’s not really like your example page.

    You could certainly use Brad’s approach. Another way would be to use Pagenavi, which I like, but it requires some mild template editing or use of hooks. The nice thing about this plugin is that it gives many display options that are not too “codey” to edit.

    Dave


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

    #49857

    nickthegeek
    Keymaster
    Post count: 751

    Susan,

    Just a note, Brad’s code is pretty good, but it can be modified to show the link on all posts but only showing the previous/next link for posts in the same category. You can see the arguments in the codex

    http://codex.wordpress.org/Function_Reference/previous_post_link

    So you would end up with something like this
    [php]
    add_action( ‘genesis_after_post_content’, ‘my_post_nav’, 5 );
    function my_post_nav() {
    if( ! is_single() )
    return;

    previous_post_link(‘<span class="single-post-nav previous-post-link">%link</span>’, ‘Previous in category’, TRUE);
    next_post_link(‘<span class="single-post-nav next-post-link">%link</span>’, ‘Next in category’, TRUE);
    }
    [/php]
    You can do a lot more with it than just that too. You can also do some cool stuff with images and add the post title and other HTML markup so that your links can have all kinds of cool styling.

    I’ve even done something custom with it on my blog to pull in a custom image size and use tags instead of categories. This took some pretty hackish custom code and it doesn’t play nice if you aren’t using categories the way I do to create series, but it works really well for my site.

    #49860

    Susan
    Moderator
    Post count: 8727

    Thank you, gentlemen! I’ll see how I go! :)


    Susan @ Graphically Designing I’d love to customize your website! I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

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

You must be logged in to reply to this topic.