Site logo

Archived topic

Change the post navigation text to "NEXT" instead of TITLE

3 replies · Started by Jakob on September 8, 2020

Viewing posts 1–4 of 4

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.

Hi there!
That worked perfectly, thank you :)

Greetz,
Jakob

Nice one.

No problem, always glad to help.:)

This archived topic is closed to new replies.