Community Forums › Forums › Archived Forums › Design Tips and Tricks › Add previous/next buttons to posts in Beautiful theme
- This topic has 16 replies, 3 voices, and was last updated 10 years, 8 months ago by
Brad Dalton.
-
AuthorPosts
-
March 12, 2014 at 11:06 am #94453
Deonne
MemberHello,
I'm trying to add previous/next links/buttons to individual posts using the Beautiful theme. I went to this tutorial: http://wpsites.net/web-design/next-previous-post-links-genesis/ but am not sure where to add the code. (Forgive me, but I'm not HTML savvy.) I went in to the Beautiful child theme's functions.php file, as instructed, and tried adding the given code at the end of that file to no effect. If someone could tell me where exactly to add this code, that would be great.
Thank you!
Deonne
http://www.deonnekahler.comMarch 12, 2014 at 11:20 am #94460Brad Dalton
ParticipantYou could use code like this in your child themes functions.php file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersadd_action('genesis_entry_footer', 'wpsites_nav_links', 25 ); function wpsites_nav_links() { if( !is_single() ) return; previous_post_link('<span class="single-post-nav previous-post-link">%link</span>', '<< Previous Post in Category', TRUE); next_post_link('<span class="single-post-nav next-post-link">%link</span>', 'Next Post in Category >>', TRUE); } Or this
12//* Remove the post navigation (requires HTML5 theme support)
remove_action(
'genesis_entry_content'
,
'genesis_do_post_content_nav'
, 12 );
March 12, 2014 at 11:41 am #94462Deonne
MemberBrad,
Thanks for the speedy response! I added that first one and it worked, but my only remaining needs are padding it so it doesn't run into the comments, and making a space between the two links, previous and next. (Again, forgive my ignorance. I'm a writer, not a tech genius, ha.)
You can see what I mean here:
What do you think? I feel like there's a whole lot of stuff going on in general at the bottom of posts and I'd like to clean them up somehow.
Thanks!
Deonne
March 12, 2014 at 11:53 am #94472Brad Dalton
ParticipantHere's the CSS you can modify http://wpsites.net/web-design/different-ways-to-add-post-navigation-pagination-in-genesis/
March 12, 2014 at 1:44 pm #94498Deonne
MemberBrad - that worked, thank you! Now I need to work on neatening everything up. Have a great day.
March 12, 2014 at 1:58 pm #94499Deonne
MemberBrad,
So sorry, I spoke too soon. What I want is the link to move through the posts chronologically, not by category. I assume there's a different code for that?
Thank you!
Deonne
March 12, 2014 at 2:01 pm #94500Brad Dalton
ParticipantMarch 12, 2014 at 2:09 pm #94502Deonne
MemberBrad,
Forgive my lameness. I did that - took out the previous code and put in that second one:
//* Remove the post navigation (requires HTML5 theme support)
remove_action( 'genesis_entry_content', 'genesis_do_post_content_nav', 12 );But nothing happened, no links. What am I doing wrong?
Thanks so much for your help,
Deonne
March 13, 2014 at 12:47 am #94596Brad Dalton
ParticipantThis should work:
12//* Remove the post navigation (requires HTML5 theme support)
add_action(
'genesis_entry_content'
,
'genesis_do_post_content_nav'
, 12 );
March 13, 2014 at 8:45 am #94659Deonne
MemberBrad,
What the heck am I doing wrong? Now I'm getting this error when I plug in the code you gave me.:
Parse error: syntax error, unexpected '[' in /home3/deonne/public_html/wp-content/themes/beautiful-pro/functions.php on line 261
I'm adding the code at the end of the child theme's functions.php file - is there a different place it should go? (I had to replace the functions file with the original to get it back to normal. Deleting the code didn't work. Argh.)
Deonne
March 13, 2014 at 8:57 am #94665Brad Dalton
ParticipantMarch 13, 2014 at 9:08 am #94668Deonne
MemberWeird. I had copied your code from the email and not this page and it gave me extra weirdness, apparently. I just plugged in the code from this page and nothing is showing up on my posts. It's just those two lines of code, correct? Any ideas?
March 13, 2014 at 9:33 am #94679Brad Dalton
ParticipantMarch 13, 2014 at 9:37 am #94682Deonne
MemberBrad - I'm sorry to be dense. Fix what? It's back to the original functions file but with those two lines of code added. Shouldn't that work?
August 25, 2014 at 3:59 pm #121004wickedsimple
MemberBrad,
I just tried doing this to add the previous and next buttons to my site and now I can't get into my site. I did copy the code from the functions.php file before I made the change. How can I restore my functions.php file back to what it was originally? I can't log into my WP dashboard or see anything but can get into my host.
This is what I had added:
12//* Remove the post navigation (requires HTML5 theme support)
add_action( ‘genesis_entry_content’, ‘genesis_do_post_content_nav’, 12 );
Donna
August 25, 2014 at 4:09 pm #121008wickedsimple
MemberBrad,
I got my site back. I'm getting pretty good at troubleshooting these days! I used WP Debug and was able to find what line of code I had to remove to get it back. All's good in the world, except I still don't know how to add the previous and next buttons to a blog post?
Donna
August 26, 2014 at 2:05 am #121076Brad Dalton
Participant -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.