Support » Plugin: Polylang » Homepage template different than page 2, 3 (pagination)

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support Chrystl

    (@chrystl)

    Hi
    Have you the same behavior on your page 2 with Polylang deactivated?

    cdonzel

    (@cdonzel)

    Hi Chrystl and thanks for your reply.

    If I deactivate polylang, I have another scenario: When I click on link to go to page #2 from the homepage, the URL looks correct (domainname.com/page/2) but when clicked, the link bring me back to my homepage (domainname.com).

    Basically, the pagination does not work as when I click on page 2 or page 3, it still bring me back to my homepage (it almost looks like I have a redirection that bring me back to my homepage permanently). Weird.

    Thank you for any hint!

    Clement

    Plugin Support Chrystl

    (@chrystl)

    Regarding your first issue, how did you set your template for the English? In theme options or with a custom code?

    cdonzel

    (@cdonzel)

    Hello Chrystl. I have used the theme option.

    Plugin Support Chrystl

    (@chrystl)

    Have you set the same template for the French and English?

    cdonzel

    (@cdonzel)

    Yes, I do have the same page template for both french and english pages. On the page area of the WP admin section, I have clicked the “+” to add a translation.

    Here is my template page code

    <?php /* Template Name: xxxx */ ?>
    
    <?php get_header(); ?>
    
    <div class="page-content">
    	<?php
    	while ( have_posts() ) : the_post();
    		get_template_part( 'content-page' );
    	endwhile;
    
    	$posts_per_page = get_option( 'posts_per_page' );
    	$paged = 1;
    	if ( get_query_var( 'paged' ) ) $paged = get_query_var( 'paged' );
    	if ( get_query_var( 'page' ) ) $paged = get_query_var( 'page' );
    
    	$blog_query_args = array(
    		'post_type' => 'post',
    		'paged' => $paged,
    		'posts_per_page' => $posts_per_page
    	);
    
    	$blog_query = new WP_Query( $blog_query_args );
    
    	if ( $blog_query->have_posts() ) :
    		echo '<div id="blog" class="blog-area">';
    			while ( $blog_query->have_posts() ) : $blog_query->the_post();
    				get_template_part( 'content' );
    			endwhile;
    		echo '</div>';
    
    		$links = paginate_links( array(
    			'prev_text' => '&larr;',
    			'next_text' => '&rarr;',
    			'total' => $blog_query->max_num_pages
    		) );
    
    		if ( $links ) {
    			echo '<nav class="posts-pagination" role="navigation">';
    				echo $links;
    			echo '</nav>';
    		}
    
    		wp_reset_postdata();
    	else :
    		get_template_part( 'content-none' );
    	endif;
    	?>  
    
    </div>
    
    <?php get_footer(); ?>
    Plugin Support Chrystl

    (@chrystl)

    How this template is named?
    EDIT: Sorry, my question was wrong: How your php file is named?

    cdonzel

    (@cdonzel)

    <?php /* Template Name: Blog Grid */ ?>

    Plugin Support Chrystl

    (@chrystl)

    EDIT: Sorry, my question was wrong: How your php file is named?

    cdonzel

    (@cdonzel)

    template-blog-grid.php

    Plugin Support Chrystl

    (@chrystl)

    Could you provide screenshots (admin side) of your English page and its French translation?
    You can upload them via http://snag.gy and link to them here.

    Please don’t cut the admin top bar and the left menu on your screenshots.

    Plugin Support Chrystl

    (@chrystl)

    Did you notice that for the English homepage that you revert on the page 1 when you click on page 2?

    cdonzel

    (@cdonzel)

    Plugin Support Chrystl

    (@chrystl)

    Unfortunately it doesn’t help.

    I notice that you have a 301 redirection on the page 2 for the English homepage.
    Some users have this redirection after update WP to 4.4: https://wordpress.org/support/topic/sudden-301-redirection-problem?replies=6#post-7799442

    cdonzel

    (@cdonzel)

    Ok, thanks Chrystl anyway for all your help.

    I will dig into this pagination issue and will report back once I have fixed it.

    Thanks again.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Homepage template different than page 2, 3 (pagination)’ is closed to new replies.