Site icon Hip-Hop Website Design and Development

Tips on how to repair pagination for customized loops on front-page.php

A search on this subject on this website throws up lots of outcomes claiming to have resolved this situation, however I’m having a opposite expertise after implementing these pointers as outlined right here:

  1. Tips on how to repair pagination for customized loops?
  2. Pagination not engaged on static web page
  3. https://stackoverflow.com/questions/14026467/pagination-on-static-front-page-wordpress

That is my code beneath:

                // Get present web page and append to customized question parameters array
                $custom_query_args['paged'] = get_query_var( 'web page' ) ? get_query_var( 'web page' ) : 1;

                // Outline customized question parameters
                $custom_query_args = array(
                    'post_type'      => 'submit',
                    'posts_per_page' => '4',
                    'paged'          => $custom_query_args['paged'],
                    'post_status'    => 'revealed',
                    'cat'    => '1',
                );

                // Instantiate customized question
                $blog_query = new WP_Query( $custom_query_args );

                // Pagination repair
                $temp_query = $wp_query;
                $wp_query   = NULL;
                $wp_query   = $blog_query;
        ?>

        <?php if ( $blog_query->have_posts() ) : ?>

        <?php /* Begin the Loop */ ?>
            <?php whereas ( $blog_query->have_posts() ) : $blog_query->the_post();  ?>
            <?php get_template_part( 'content material', get_post_format() ); ?>

        <?php endwhile; ?>

        <?php endif; // finish have_posts() test ?>

        <?php // Reset postdata
            wp_reset_postdata();

            // Customized question loop pagination
            previous_posts_link( 'Older Posts' );
            next_posts_link( 'Newer Posts', $blog_query->max_num_pages );

            // Reset principal question object
            $wp_query = NULL;
            $wp_query = $temp_query;
        ?>

Once I click on on the pagination hyperlink displayed on the frontpage, a 404 Not Discovered response is proven. (The requested URL /kobopulse/web page/2/ was not discovered on this server.)

I’m utilizing the newest model of wordpress. On the settings web page my set up is configured to show a static entrance web page. Entrance-page.php is my customized web page template for the frontpage

What do I have to do in another way.

Thanks