Skip to main content
added 146 characters in body
Source Link

More Info: it is currently set as the index.php page, even though it's not the home page. if you get to it through misspelling a url, it works

More Info: it is currently set as the index.php page, even though it's not the home page. if you get to it through misspelling a url, it works

added 66 characters in body
Source Link

So I've been looking into why the pagination isn't working, but I just can't find anything. When it goes to page 2, it just shows the same as the first page. Any other ideas?

So I've been looking into why the pagination isn't working, but I just can't find anything. Any other ideas?

So I've been looking into why the pagination isn't working, but I just can't find anything. When it goes to page 2, it just shows the same as the first page. Any other ideas?

Source Link

Wordpress Pagination not working, any ideas?

So I've been looking into why the pagination isn't working, but I just can't find anything. Any other ideas?

    <?php  global $paged; get_template_part( 'template-parts/header'); 
    if ( $total > 1 )  {
         // get the current page
         if ( !$current_page = get_query_var('paged') )
              $current_page = 1;
         // structure of "format" depends on whether we're using pretty permalinks
         if( get_option('permalink_structure') ) {
             $format = '?paged=%#%';
         }
         }
     ?>
<div class="blog-inner">
      <div class="grid-container">
        <div class="grid-x">
          <div class="large-8 column">
            <?php
              if ( get_query_var('paged') ) {
                 $paged = get_query_var('paged');
                } elseif ( get_query_var('page') ) {
                 $paged = get_query_var('page');
                } else {
                 $paged = 1;
                }

              $blogs = array(
                'post_type'      => 'post',
                'order'      => 'DESC',
                'posts_per_page' =>  3,
                'paged'      => $paged
              );

              $blog_posts = new WP_Query($blogs); ?>
            <?php if ( $blog_posts->have_posts() ) : while ( $blog_posts->have_posts() ) : $blog_posts->the_post(); ?>
              <div class="blog-post">
                <h4><?php the_title(); ?></h4>
                <div class="byline">
                  
                <p><?php the_excerpt(); ?></p>
                
                  ?>
                </div>
                <div class="read-all">
                  <a href="<?php the_permalink();?>" class="">Read The Post</a>
                </div>
              </div>
            <?php endwhile; ?>
            <div class="pagination">
              <?php wp_reset_query(); ?>
                  <?php 
                      echo paginate_links( array(
                          'base'         => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
                          'total'        => $blog_posts->max_num_pages,
                          'current'      => max( 1, get_query_var( 'paged' ) ),
                          'format'       => '?paged=%#%',
                          'show_all'     => false,
                          'type'         => 'plain',
                          'end_size'     => 2,
                          'mid_size'     => 1,
                          'prev_next'    => true,
                          'prev_text'    => sprintf( '<i></i> %1$s', __( 'Newer Posts', 'text-domain' ) ),
                          'next_text'    => sprintf( '%1$s <i></i>', __( 'Older Posts', 'text-domain' ) ),
                          'add_args'     => false,
                          'add_fragment' => '',
                      ) );
                  ?>
              </div>
             
            <?php endif; ?>
          </div>
                </div>
                <?php endwhile; ?>
              </div>
            <?php endif; ?>
          </div>
        </div>
      </div>
    </div>

[some html-taken out, so some divs might not match up]