diff for posts_paged with permalinks
-
Hiya,
Here’s my suggestion for how to make theposts_paged
option look good with a site that has permalinks enabled. It’s a change to the URL generation code insidewp-includes/template-functions-posts.php
and it correctly adds the separator depending on the existance previousGET
parameters (like a search, when?
will already have been included in the URL):
357c357
< $qstr = $_SERVER['REQUEST_URI'];
---
> $qstr = $_SERVER['QUERY_STRING'];
373,379c373,375
< echo get_settings('home') . $qstr;
< if (strpos($qstr,'?') === FALSE) {
< echo $querystring_start;
< } else {
< echo $querystring_separator;
< }
< echo 'paged'.$querystring_equal.$nextpage;
---
> echo get_settings('home') .'/'.$pagenow.$querystring_start.
> ($qstr == '' ? '' : $qstr.$querystring_separator) .
> 'paged'.$querystring_equal.$nextpage;
414c410
< $qstr = $_SERVER['REQUEST_URI'];
---
> $qstr = $_SERVER['QUERY_STRING'];
429,435c425,427
< echo get_settings('home') . $qstr;
< if (strpos($qstr,'?') === FALSE) {
< echo $querystring_start;
< } else {
< echo $querystring_separator;
< }
< echo 'paged'.$querystring_equal.$nextpage;
---
> echo get_settings('home') .'/'.$pagenow.$querystring_start.
> ($qstr == '' ? '' : $qstr.$querystring_separator) .
> 'paged'.$querystring_equal.$nextpage;
Basically, change theQUERY_STRING
toREQUEST_URI
so we don’t have to figure out where in the permalinks we are, and then a (messy)if..then
block that could be shrunk down to a?
line (I think) that decides if we need a?
or an&
before thepaged
value.
Hope that helps someone !
—
ian.
- The topic ‘diff for posts_paged with permalinks’ is closed to new replies.