- This topic has 13 replies, 3 voices, and was last updated 4 years, 6 months ago by David.
-
AuthorPosts
-
October 15, 2019 at 8:32 am #1035349Ernst Wilhelm
I ‘ve turned on the pref next mode in a way
< prev post_title next post_title >1st What do I need to do convert the post_title link into a button.
2nd Can I change the post_title into something like previous for the left option and next for the right option.Cheers, Ernst Wilhelm Grüter
October 15, 2019 at 11:00 am #1035519LeoStaffCustomer SupportHi there,
1. Let’s try solve #2 first then I’ll provide some CSS.
2. Can you try this PHP snippet here?
https://generatepress.com/forums/topic/changing-post-navigation-text-to-next-instead-of-title/#post-737583Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know 🙂
October 15, 2019 at 12:06 pm #1035575Ernst WilhelmIt works fine. Thanks.
October 15, 2019 at 12:36 pm #1035607LeoStaffCustomer SupportNow you can add some CSS to make it a button style:
span.next, span.prev { background-color: #000; padding: 15px 10px; }
October 15, 2019 at 1:06 pm #1035622Ernst WilhelmWhat do i need to do to apply the theme style to the button (e.g. post comment button or read more button)?
Thank you.
October 15, 2019 at 1:35 pm #1035633LeoStaffCustomer SupportCan you modify the PHP snippet to this:
add_filter( 'next_post_link', function( $output, $format, $link, $post ) { if ( ! $post ) { return ''; } return sprintf( '<div class="nav-next"><span class="next button"><a href="%1$s" title="%2$s">Next</a></span></div>', get_permalink( $post ), $post->post_title ); }, 10, 4 ); add_filter( 'previous_post_link', function( $output, $format, $link, $post ) { if ( ! $post ) { return ''; } return sprintf( '<div class="nav-previous"><span class="prev button"><a href="%1$s" title="%2$s">Previous</a></span></div>', get_permalink( $post ), $post->post_title ); }, 10, 4 );
Then remove the CSS I provided above?
Let me know 🙂
October 16, 2019 at 2:04 am #1035957Ernst WilhelmHello Leo. Rmoving the css stuff gave it a pure text style approach. So I decided not to remove the css you provided. This comes close to what I want. Only outstanding issue for now is I need to change the color of the text wihtin the button into white.
>>> SORRY I RE-OPENDED THE TOPIC <<<
October 16, 2019 at 9:14 am #1036431DavidStaffCustomer SupportHi there,
this CSS to change the next / prev text color:
span.next, span.prev, span.next a, span.prev a { color: #fff; }
October 16, 2019 at 10:20 am #1036481Ernst WilhelmHi David. Many thanks.
I am sorry but it there is another question poppin’ up (hopefully the last one 🙂 )
How do I define the color setting for mouse hover?Cheers
October 16, 2019 at 10:57 am #1036516DavidStaffCustomer SupportLike so:
span.next:hover, span.prev:hover, span.next:hover a, span.prev:hover a { color: #fff; }
October 16, 2019 at 12:50 pm #1036610Ernst WilhelmGreat. Now another question. The hoover color for the button itself. Your advice is really appreciated.
October 16, 2019 at 12:52 pm #1036614DavidStaffCustomer SupportTry this:
span.next:hover, span.prev:hover { background-color: #000; }
October 16, 2019 at 12:58 pm #1036621Ernst WilhelmThanks David.
October 16, 2019 at 1:04 pm #1036630DavidStaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.