• Hi,

    I might have found a bug as the pagination on my homepage does not work.
    My home page is actually doing a query_posts() on a post custom type and the first page works as expected but when I click on the next/older navigation link then the page url becomes ?lang=en&paged=2 and this is trying to render an archive page instead of my static home page.

    Cheers,

    https://www.ads-software.com/extend/plugins/polylang/

Viewing 3 replies - 31 through 33 (of 33 total)
  • Plugin Author Chouby

    (@chouby)

    With your code, I finally reproduced the bug. Even whith Polylang deactivated ??
    For what I have understood, the 404 error is set before the template is loaded. So at that time, the query contains only ‘post’, not ‘project’. When you request more posts than contained in ‘post’, the 404 error is set and the 404 template is loaded. To correct that, you must modify the query sooner. For example:

    add_action('pre_get_posts', 'my_posts');
    function my_posts($query) {
    	if (is_tag()) {
    		$qvars = $query->query_vars;
    		$qvars['post_type'] = array('post', 'project');
    		$query->parse_query($qvars);
    	}
    }

    Thread Starter Nico

    (@nikospkrk)

    You’re absolutely right, I should have thought of it to be honest. Sorry for bothering you with an issue NOT related to your (superb) plugin. At least I spotted two previous bugs, (un)fortunately the third wasn’t one.
    I know it’s off topic, but instead of displaying the project posts with the other posts, do you think there’s a way to use project-only tags? Although your modification is working like a charm, I think it’d be even better if my ‘CSS’ tag for a ‘project’ would not be counted in a ‘CSS’ tag for my acutal (blog) posts.
    Thank you very much!

    Thread Starter Nico

    (@nikospkrk)

    I just noticed that when I use that function in my archives.php page it gets rid of my language menu (although the actual language switching menu does work).
    I tried to add a ‘lang’ parameter without success:

    $locale = get_locale();
    $qvars['lang'] = substr($locale, 0, 2);

    It’s even doing the bug of the single_tag_title() again when I add it.

Viewing 3 replies - 31 through 33 (of 33 total)
  • The topic ‘[Plugin: Polylang] Homepage pagination bug’ is closed to new replies.