In the Posts module with Pagination Style = Numbers, is it possible to change the “Previous” and “Next” text links to say “Newer” and “Older” instead? Is there a way to customize these labels with a CSS tweak or via some other method?
“Previous” and “Next” are a bit ambiguous. People may not immediately grasp that “Next” means backwards in time and “Previous” means forward in time.
The WordPress search results page uses “Older Posts” and “Newer Posts” to navigate, so it would be nice to make the pagination text for the Posts module use similar wording.
I took a look at BB’s code in class_fl_theme.php, and I have some suggestions. The way you guys coded post_navigation() and archive_nav() seems inconsistent. I’d recommend updating one or both of these functions to have more consistent behavior.
Here are some inconsistencies in how they work:
post_navigation() uses &larr and &rarr, but archive_nav() uses « and » for the navigational arrows. I think both should use &larr and &rarr since those look nicer. Why use two different kinds of arrows?
post_navigation() uses <nav> and <div>s while archive_nav() uses <div> and <span>s for the same structures. Ideally these should use identical elements for identical structures. Otherwise it just makes it more complicated to tweak the CSS for these elements.
post_navigation() places its content after .fl-post-content but before </article>, so it’s still inside the article body. However, archive_nav() places its content after </article>, so it’s outside the article body. This is weird and makes it harder to do CSS tweaking on these elements since the location of the navigation area is inconsistent. Pick a side (inside or outside of <article>), and use that same location for both.
I hope you are prepared, let’s do this on a child theme. When you are done, copy the index.php file from our BB theme into your child theme. Open class-fl-child-theme.php in your child theme and insert the following code into the helper class. Change the Newer Posts/ Older Posts text to whatever you want.
When you are done, open index.php in your child theme and navigate to line 18. Change the following code.
Change this
<?php FLTheme::archive_nav(); ?>
To this
<?php FLChildTheme::archive_nav_child(); ?>
Just save the file and you should be good to go. If you are still not sure about this, please provide your server FTP login details and your WordPress WP login. We’ll try to apply the changes for you.
Thanks, KC. I know PHP pretty well, so making those changes was no trouble. That lets me customize the navigation at the bottom of search and archives pages, which is great. How do I similarly customize the pagination link text that appears at the bottom of BB’s Posts module?
Those links appear in little boxes and look like this:
It looks like what I’d need to do to accomplish the above is to override the function called pagination() in class-fl-builder-loop.php.
That pagination() function calls the WordPress function paginate_links(), and I’d just need to add a couple extra arguments there to override the default, so I’d edit this call on line 147 of class-fl-builder-loop.php:
I would like to apologize that I might have misunderstood your question earlier. I thought you want to modify the default blog posts navigation. I will come back to you shortly.
It might be a nice feature to add this simple customization to the BB posts module for everyone by letting them pick the labels for the Previous and Next links… or by adding it to the BB theme if that’s doable.
My readers have often found Previous and Next confusing. They automatically think of Next as referring to the future, when it actually retrieves older posts.