Community Forums › Forums › Archived Forums › General Discussion › Add Previous/Next Post Code after Single Post
Tagged: previous/next post code
- This topic has 9 replies, 2 voices, and was last updated 9 years, 2 months ago by Ren Ventura.
-
AuthorPosts
-
January 10, 2015 at 8:32 pm #136951skichic95Member
I'm on the Lifestyle Theme (not Lifestyle Pro) and recently noticed that my previous/next post links that used to appear under each of my single posts has disappeared. I tried adding in the code from StudioPress files into my functions.php file and I crashed my site this morning. After working with my host, I was able to get my site back up.
I also recently noticed that the code or html snippets that I had in my Simple Hooks plugin has all been erased, except for my Pin It code.
I don't want to risk crashing my site again. How do I go about getting the code back on my site for the Previous Post/Next Post links?
http://pinkheelspinktruck.com/January 10, 2015 at 9:39 pm #136959Ren VenturaMemberYou can use something like this in your functions.php:
//* Add post navigation to single posts add_action( 'genesis_entry_footer', 'rv_single_post_nav' ); function rv_single_post_nav() { if ( is_singular( 'post' ) ) : ?> <span class="post-previous alignleft"><?php previous_post_link( '%link' ) ?></span> <span class="post-next alignright"><?php next_post_link( '%link' ) ?></span> <?php endif; }
Just add styling if you want them to look different (i.e. like buttons).
Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren
January 11, 2015 at 11:51 am #137070skichic95MemberI don't want to make another change in my functions.php file and risk crashing it again. There should've been no reason that it crashed the first time, but I can't afford to be down for another day. Can I place this into a simple hook and execute php on it?
January 12, 2015 at 2:55 pm #137233Ren VenturaMemberYou can insert this code in the genesis_entry_footer section:
<?php if ( is_singular( 'post' ) ) : ?> <span class="post-previous alignleft"><?php previous_post_link( '%link' ) ?></span> <span class="post-next alignright"><?php next_post_link( '%link' ) ?></span> <?php endif; ?>
Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren
January 17, 2015 at 3:51 pm #137803skichic95MemberI don't have the genesis_entry_footer section in my Simple Hooks. Also, do you click the box, execute PHP on this to get it to work, if I place the code in another hook? So far I cannot get it to work with either way. And I'm inserting it after the comments hook: genesis_after_comments
January 17, 2015 at 11:53 pm #137831Ren VenturaMemberThe plugin includes the genesis_entry_footer hook. It's a long options page so you might want to do a search using CTRL/CMD F to find it quickly.
Also, yes you do check the box to execute PHP.
Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren
January 20, 2015 at 10:08 pm #138157skichic95MemberIt doesn't exist in my Simple Hooks. I double checked in my Screen Options to see if everything was selected and it was. I used the find function and nothing. I even doubled checked to see if I was running an updated version. the genesis_entry_footer hook does not exist on my end.
January 21, 2015 at 1:28 am #138165Ren VenturaMemberI'm not sure how that could be. If you can't use the Simple Edits plugin, your only other options are to insert the code from my first response into your functions.php or a dedicated plugin. If you're against doing this on your own, you can email me (see footer link) and I'll assist.
Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren
January 25, 2015 at 8:05 pm #138626skichic95MemberI just realized you were talking about Simple Edits and I was talking about Simple Hooks. I tried adding Simple Edits plugin and it's telling me I'm not using the right Genesis version. I have no idea how I'm not using the right Genesis version. My version is showing to be up to date. Again, I tried adding the code in myself into my functions.php file and it crashed my site the last time I tried it. I don't know what you would do any differently and I can't afford for my site to crash again.
January 26, 2015 at 2:24 pm #138693Ren VenturaMemberSorry about that. I misspoke in my last reply. I meant to say Simple Hooks, not Simple Edits.
Personally, I would add the code to my functions.php. You likely had some sort of syntax error last time, which caused your site to break. Completely avoiding the functions.php file because of one mistake is going to make working with Genesis more difficult. I can't think of a reason for why you wouldn't have that hook available in the Simple Hooks plugin. Are you able to use FTP? Just download your functions.php file, create a backup copy, make your changes and re-upload. If anything breaks, you can restore the backup.
Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.