Community Forums › Forums › Archived Forums › Design Tips and Tricks › previous post / next post
Tagged: next, post navigation, previous
- This topic has 14 replies, 3 voices, and was last updated 11 years, 7 months ago by wendycholbi.
-
AuthorPosts
-
February 6, 2013 at 1:43 pm #18484verymomMember
I am running Prose, and have the older / newer links at the bottom of the blog page, but would like to add the 'previous post / next post' links to individual post pages - I'd like to use the following code, which will turn those links into post titles. In previous themes, I could just add this code to the single.php page - but I'm still utterly lost in the Genesis framework. All the templates I'm used to are missing, buried, or hidden in function-type files. So, help. Where would something like this go?
<code>
<div class="navigation">
<div class="alignleft">
<?php previous_post('« « %',
'Toward The Past: ', 'yes'); ?>
</div>
<div class="alignright">
<?php next_post('% » » ',
'Toward The Future: ', 'yes'); ?></code>February 6, 2013 at 2:29 pm #18496wendycholbiMemberI suggest checking out these Genesis code snippets for post navigation -- the "next page" and "previous page" snippets may be what you're looking for. You can customize the link text as you wish.
The instructions on those snippets say to add them to your functions.php file, but Prose works differently: Instead of modifying the functions.php file, you should place custom functions (PHP snippets) in Genesis --> Custom Code --> Custom Functions.
And...welcome to Genesis! Yes, there is a learning curve, as there is with anything new -- but the end results, and the power and flexibility of the framework, are so worth it. The Genesis Tutorials and Code Snippets are great places to start digging in.
I love WordPress, Genesis, and the Prose child theme (my complete guide to using Prose is here: SiteSetupKit.com). Say hi on Twitter: @wendycholbi
February 6, 2013 at 2:55 pm #18502verymomMemberI've been using Genesis themes for a few years, but get overwhelmed every time I deal with customizing one.
I don't see a Genesis -> Custom code -> Custom Functions in the menu.
I have Genesis - Theme Settings, Design Settings, SEO Settings, Import / Export, Simple Comments, Simple Edits.
Am I looking in the wrong place? I've made other edits to the functions.php file, but this one won't work there.
February 6, 2013 at 4:09 pm #18524wendycholbiMemberAre you using Prose version 1.0? The Custom Code screen was added in version 1.5.
You won't see a dashboard nag to update from 1.0 to 1.5 because it requires manual updating (I wrote a tutorial about the 1.0 --> 1.5 update process).
I love WordPress, Genesis, and the Prose child theme (my complete guide to using Prose is here: SiteSetupKit.com). Say hi on Twitter: @wendycholbi
February 6, 2013 at 4:21 pm #18528verymomMemberI suppose not - it's not a child theme so I don't want to upgrade. (I've learned to do child themes since). Any other way to add this?
February 6, 2013 at 5:17 pm #18541wendycholbiMemberOkay, I don't know what you mean by "it's not a child theme," because Prose is a child theme of the Genesis Framework. Prose 1.5 has some significant improvements over version 1.0 (not the least being the Custom Code screen, but also more and better Design Settings), so my default recommendation is to update, but it's your call as to whether that's more trouble than it's worth (for instance if you've made extensive modifications to the functions.php file).
So, looking at your original question another way, you could probably insert your original code into one of the Genesis hooks, using the Genesis Simple Hooks plugin. Check out the Hook Reference and this Visual Hook Guide to find the hook you need.
I love WordPress, Genesis, and the Prose child theme (my complete guide to using Prose is here: SiteSetupKit.com). Say hi on Twitter: @wendycholbi
February 6, 2013 at 5:24 pm #18544verymomMemberSorry, I meant that I directly edited Prose files rather than making a child theme to Prose. So if I update it I will lose all my customizations. It will be much more trouble than its worth.
Can you explain in more detail about the hooks? I've installed the plugin but the reference and hook guide gives me no clue as to how to take my code above and make it work.
Thank you!
February 6, 2013 at 7:44 pm #18562wendycholbiMemberI would try pasting your code into Genesis --> Simple Hooks --> genesis_after_post_content hook (it's in the section of the page titled "Post/Page Hooks".
Check the "Execute PHP on this hook?" checkbox, since your code contains PHP. Save your changes and see if the navigation links show up correctly on a single post.
I tested this on a test site of mine, and this code worked (note the two closing div tags that were missing from your original code above):
<div class="navigation">
<div class="alignleft">
<?php previous_post('« « %',
'Toward The Past: ', 'yes'); ?>
</div>
<div class="alignright">
<?php next_post('% » » ',
'Toward The Future: ', 'yes'); ?>
</div>
</div>
I love WordPress, Genesis, and the Prose child theme (my complete guide to using Prose is here: SiteSetupKit.com). Say hi on Twitter: @wendycholbi
February 6, 2013 at 8:50 pm #18567verymomMemberOh thank you!! That worked, yay!
February 6, 2013 at 9:28 pm #18570verymomMemberOh shoot - it's showing up on the main blog page, not just on single posts. I have it in this section:
genesis_after_post_content
What can I do to make it only show on the single posts?February 6, 2013 at 9:30 pm #18572verymomMemberOh nevermind, I just added it to the
genesis_after_comment_form
area and that solved it.Thanks for all your help!
February 6, 2013 at 9:45 pm #18575wendycholbiMemberHooray! Glad to hear you got it working.
I love WordPress, Genesis, and the Prose child theme (my complete guide to using Prose is here: SiteSetupKit.com). Say hi on Twitter: @wendycholbi
February 13, 2013 at 1:16 pm #20121NewSeasonDesignMemberThis worked great!
February 13, 2013 at 1:18 pm #20123NewSeasonDesignMemberAnd thanks so much!!
February 16, 2013 at 1:52 pm #20707wendycholbiMemberGlad to hear it worked for you too!
I love WordPress, Genesis, and the Prose child theme (my complete guide to using Prose is here: SiteSetupKit.com). Say hi on Twitter: @wendycholbi
-
AuthorPosts
- The topic ‘previous post / next post’ is closed to new replies.