Understrap Custom Pagination – WordPress Development Stack Exchange
I am using the great Understrap and I am using a custom post type (for my Staff). In my Staff CPT, the Title field is used for “First-name Last-name”. Example, “John Smith” is one of my post titles and “Jane Doe” is another CPT item title.
Now, the Pagination Understrap is outputting the same exact full names for Next and Previous links at the bottom of the loop. But is there a way to tweak this behavior so the Previous link in the pagination reads “< Meet John” and the Next link reads “Meet Jane >”? I only want the first names to show in the pagination instead of the full post title which is First-name and Last-name.
Looks like the part that is outputting the Pagination is in template-tags.php under inc folder and it looks like this:
<?php
if ( get_previous_post_link() ) {
previous_post_link( '<span class="nav-previous">%link</span>', _x( '<i class="fa fa-angle-left"></i> %title', 'Previous post link', 'understrap' ) );
}
if ( get_next_post_link() ) {
next_post_link( '<span class="nav-next">%link</span>', _x( '%title <i class="fa fa-angle-right"></i>', 'Next post link', 'understrap' ) );
}
?>
My preferred option is to get only the first name from the post title and prepend “Meet” to the first names. I do have ACF in case creating a custom field specifically for first-names creates more flexibility.
Leave an answer