paginate_links outputting single quotes on some attributes
-
Hi,
I’m just trying to understand if this is the way things are designed to work, or it’s a bug in the file.
I’m working in WordPress 4.8.20, building a theme from scratch (to re-learn how it’s done after years of child themes), and I’m using
<?php the_posts_pagination(); ?>
to create the numbered pagination at the bottom of my archive pages. All good, except I notice that some of the links – the page numbers links – are coming out with only a single quote on their attributes.
I looked into the wp-inclides/general-templte.php file, and in the paginate_links function, I can see the bit of code that’s responsible:
$page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>'; endif; for ( $n = 1; $n <= $total; $n++ ) : if ( $n == $current ) : $page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>"; $dots = true;
Why is it swapping the order of single and double quotes between these two page links functions sections? I have no idea if it’s for a purpose, all I know is when I look at the source of the html that gets generated, the previous and next links have their attributes double quoted, but the actual page numbers themselves, linked and unlinked, are all single quote attributes.
Can I replicate the entire paginate_links function in my theme’s functions.php file to change that, and alleviate my OCD over the attribute quoting being different, or is this done for a reason, that would result in a breakage if I tried to make it “consistent”?
Thanks.
- The topic ‘paginate_links outputting single quotes on some attributes’ is closed to new replies.