Community Forums › Forums › Archived Forums › Design Tips and Tricks › Previous Next Buttons for Category
Tagged: Category; News Theme; Buttons;
- This topic has 4 replies, 4 voices, and was last updated 10 years, 9 months ago by Susan.
-
AuthorPosts
-
July 8, 2013 at 10:44 am #49809SusanModerator
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!
http://www.demo.graphicallydesigning.comJuly 8, 2013 at 11:08 am #49815Brad DaltonParticipantIf 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
July 8, 2013 at 11:37 am #49817David ChuParticipantHi,
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
July 8, 2013 at 3:26 pm #49857nickthegeekMemberSusan,
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_linkSo you would end up with something like this
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); }
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.
July 8, 2013 at 3:40 pm #49860SusanModeratorThank you, gentlemen! I'll see how I go! ๐
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.