You could potentially use the before
, after
, and separator
arguments passed to wp_link_pages()
to wrap each item in a span, then target the spans via CSS.
Here’s your current code:
wp_link_pages(
'before=LQ &pagelink=Chapter %'
);
Converting to an array, because it’s easier to follow/manipulate:
wp_link_pages( array(
'before' => 'LQ ',
'pagelink' => 'Chapter %'
) );
Let’s modify it:
wp_link_pages( array(
'before' => '<p class="link-pages">LQ<span class="page-link">',
'after' => '</span></p>',
'separator' => '</span><span>',
'pagelink' => 'Chapter %'
) );
This will produce output like (line breaks added for readability):
<p class="link-pages">
LQ
<span class="page-link">Chapter 1</span>
<span class="page-link">Chapter 2</span>
<span class="page-link">Chapter 3</span>
<span class="page-link">Chapter 4</span>
</p>
Then you can use CSS to style the <span>
s according to your needs.
Edit
Alternative/related suggestion:
You can pass 'echo' => false
to return the markup as a string:
$page_links = wp_link_pages( array(
'before' => '<p class="link-pages">LQ<span class="page-link">',
'after' => '</span></p>',
'separator' => '</span><span>',
'pagelink' => 'Chapter %',
// Return, don't echo
'echo' => false
) );
Then, you can use whatever tools at your disposal (PHP, RegEx, etc.) to manipulate $page_links
however necessary to suit your needs.
Note
Please note: CSS and PHP/RegEx are off-topic for WPSE.