Tagged: x
-
AuthorPosts
-
April 19, 2016 at 9:17 am #890114
thetastesfParticipantCan you tell me how to set up/add a previous post button at the end of my posts? thetastesf.com
April 19, 2016 at 9:18 am #890116
thetastesfParticipantThis reply has been marked as private.April 19, 2016 at 12:42 pm #890499
Prasant RaiModeratorHello There,
Thanks for writing in!
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.
Kindly use following code in your child theme’s functions.php file:
add_action ('the_content', 'add_next_post_item_link' ); function add_next_post_item_link ( $content ) { if ( is_singular('post') ) { $next_name = "Next Post <i class=\"x-icon-chevron-right\"></i>"; $prev_name = "<i class=\"x-icon-chevron-left\"></i> Previous Post"; $next_link = get_next_post() ? '<a style="float: left;" href="' . get_permalink( get_next_post()->ID ) . '">' . $prev_name . '</a>' : ''; $prev_link = get_previous_post() ? '<a style="float: right;" href="' . get_permalink( get_previous_post()->ID ) . '">' . $next_name . '</a>' : ''; $posts = '<div class="wp-post-navigation-next">'.$next_link.$prev_link.'</div>'; return $content . $posts; } else { return $content; } }Let us know how it goes.
Thanks.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-890114 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
