Inside my archive template, I’m using a pagination.
it is generated by the function paginate_links()
https://developer.wordpress.org/reference/functions/paginate_links/
I try to find out how to implement rel attributes : next and prev inside the links, like this :
<a class="page-numbers" rel="prev" href="mywebsite.fr/blog/page/1/#target">1</a>
<span class="page-numbers current" href="mywebsite.fr/blog/page/2/#target">2</span>
<a class="page-numbers" rel="next" href="mywebsite.fr/blog/page/3/#target">3</a>
Have you ever encountered this problem ? Have you use a hook ?
Thanks for your replies !
2
Answers
You can add
rel=prev
andrel=next
to your paginated links by adding theprev_text
andnext_text
arguments like the following:To resolve this, I took the HTML template returned by the function and replaced the string near the class of link, like this:
In my case I’m using twig, but you can easily change that to PHP replace.