• Resolved jais-p

    (@jais-p)


    Hello all,

    I am facing a issue on this site:
    https://blog.cybelangel.com

    Pagination on homepage is not working (I’m not using a static page). For instance, https://blog.cybelangel.com/page/2 is not showing the second page of articles. However, pagination on categories work:
    https://blog.cybelangel.com/category/articles-en/page/2

    I am using MDLWP theme.
    The code for the index page is pretty standard

    <?php  if ( have_posts() ) : ?>
    
                            <?php /* Start the Loop */ ?>
                            <?php  while ( have_posts() ) : the_post(); ?>
    
                                    <?php
    
                                            /*
                                             * Include the Post-Format-specific template for the content.
                                             * If you want to override this in a child theme, then include a file
                                             * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                                             */
                                            get_template_part( 'template-parts/content', get_post_format() );
                                    ?>
    
                            <?php endwhile; ?>
    
                            <?php mdlwp_posts_navigation(); ?>
    
                    <?php else : ?>
    
                            <?php get_template_part( 'template-parts/content', 'none' ); ?>
    
                    <?php endif; ?>

    I have checked for

    get_query_var()

    which always returns 0 whatever URL I type.

    I have tried disabling all plugins, without success.

    As far as I remember, pagination and navigation links on homepage used to work about a week ago.
    Only thing changed on the server is the installation of cURL.

    Would anyone have any suggestions as to where the issue might be coming?

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello jais-p,
    Please try using the below updated code this will help you:

    if ( get_query_var('paged') ) {
        $paged = get_query_var('paged');
    } elseif ( get_query_var('page') ) {
        $paged = get_query_var('page');
    } else {
        $paged = 1;
    }
    $args = array('paged' => $paged );
    query_posts($args); ?>
    <!-- the loop -->
    
    <?php  if ( have_posts() ) : ?>
    
                            <?php /* Start the Loop */ ?>
                            <?php  while ( have_posts() ) : the_post(); ?>
    
                                    <?php
    
                                            /*
                                             * Include the Post-Format-specific template for the content.
                                             * If you want to override this in a child theme, then include a file
                                             * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                                             */
                                            get_template_part( 'template-parts/content', get_post_format() );
                                    ?>
    
                            <?php endwhile; ?>
    
                            <?php mdlwp_posts_navigation(); ?>
    
                    <?php else : ?>
    
                            <?php get_template_part( 'template-parts/content', 'none' ); ?>
    
                    <?php endif; ?>

    Thanks

    Thread Starter jais-p

    (@jais-p)

    Just want I needed!
    Thank you very much Clarion Technologies!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination issue on homepage’ is closed to new replies.