[Resolved] Change the post navigation text to “NEXT” instead of TITLE

Home Forums Support [Resolved] Change the post navigation text to “NEXT” instead of TITLE

Home Forums Support Change the post navigation text to “NEXT” instead of TITLE

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1435771
    Jakob

    Hello there!

    Just like the following post: https://generatepress.com/forums/topic/changing-post-navigation-text-to-next-instead-of-title/
    I would like to change the navigation text of a single post to my own text instead of the real title.

    I don’t use a childtheme.

    How can I change the name of the navigation using css?

    Thank you!

    #1435836
    Elvin
    Staff
    Customer Support

    Hi Jakob,

    I’m afraid you can’t change the name of the navigation with only CSS as this requires few alterations on how WordPress works.

    Tom’s provided solution here is split in 2 different codes.

    This part is PHP code:

    add_filter( 'previous_post_link', function( $output, $format, $link, $post ) {
      	if ( ! $post ) {
    	  return '';
    	}
      
    	return sprintf(
    		'<div class="nav-previous"><span class="prev"><a href="%1$s" title="%2$s">Previous</a></span></div>',
    	  	get_permalink( $post ),
    	  	$post->post_title
    	);
    }, 10, 4 );

    Here’s How to add PHP

    This part is CSS code:

    .post-navigation {
        display: flex;
    }
    
    .nav-previous {
        margin-right: auto;
    }
    
    .nav-next .next:before {
        display: none;
    }
    
    .nav-next .next:after {
        font-family: GeneratePress;
        content: "\f105";
        text-decoration: inherit;
        position: relative;
        margin-left: .6em;
        width: 13px;
        text-align: center;
        display: inline-block;
        -moz-osx-font-smoothing: grayscale;
        -webkit-font-smoothing: antialiased;
        font-style: normal;
        font-variant: normal;
        text-rendering: auto;
        line-height: 1;
        speak: none;
    }

    Here’s How to add CSS

    Let us know if it works for you.

    #1436214
    Jakob

    Hi there!
    That worked perfectly, thank you 🙂

    Greetz,
    Jakob

    #1437118
    Elvin
    Staff
    Customer Support

    Nice one.

    No problem, always glad to help.:)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.