Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Pagination Issues Fixed

mikeoberdick Mar 27th, 2016 175 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. //* Template Name: Homepage Blog
  4. //* Displays the default editor content followed by blog posts from all categories
  5.  
  6. get_header ();
  7.  
  8. do_action( 'genesis_before_content_sidebar_wrap' );
  9.     genesis_markup( array(
  10.         'html5'   => '<div %s>',
  11.         'xhtml'   => '<div id="content-sidebar-wrap">',
  12.         'context' => 'content-sidebar-wrap',
  13.     ) );
  14.  
  15. //* Display the default WordPress editor content
  16.  
  17. if ( have_posts() ) : while ( have_posts() ) : the_post();?>
  18.  
  19.     <?php the_content (); ?>
  20.     <?php endwhile;
  21.     else : //* if no posts exist
  22.     do_action( 'genesis_loop_else' );
  23.     endif; //* end loop
  24.  
  25. do_action( 'genesis_before_content' );
  26.     genesis_markup( array(
  27.         'html5'   => '<main %s>',
  28.         'xhtml'   => '<div id="content" class="hfeed">',
  29.         'context' => 'content',
  30.         ) );
  31.  
  32. //* Create a new loop to display the blog posts
  33.  
  34. $paged = get_query_var('page');
  35. query_posts( array( 'paged' => $paged ) );
  36. $new_query = new WP_Query();
  37. $new_query->query('posts_per_page=10&paged='.$paged);
  38.  
  39. // Pagination fix
  40. $temp_query = $wp_query;
  41. $wp_query   = NULL;
  42. $wp_query   = $new_query;
  43.  
  44. do_action( 'genesis_before_loop' );
  45.  
  46. if ( $new_query->have_posts() ) :
  47.  
  48. do_action( 'genesis_before_while' );
  49.  
  50. while ( $new_query->have_posts() ) : $new_query->the_post();
  51.  
  52. do_action( 'genesis_before_entry' );
  53.  
  54. printf( '<article %s>', genesis_attr( 'entry' ) );
  55.  
  56. do_action( 'genesis_before_entry_content' );
  57.  
  58. if ( has_post_thumbnail() ) {
  59. the_post_thumbnail('full');
  60. }
  61.  
  62. echo '<h2 class="entry-title" itemprop="headline"><a href = "' . get_permalink () . '" rel="bookmark">' . get_the_title () . '</a></h2>';
  63.  
  64. echo '<p class="read_more"><a href = "' . get_permalink() . '">READ MORE</a></p>';
  65.  
  66. do_action( 'genesis_after_entry_content' );
  67.  
  68. echo '</article>';
  69.  
  70. do_action( 'genesis_after_entry' );
  71.  
  72. endwhile; //* end of one post
  73. do_action( 'genesis_after_endwhile' );
  74.  
  75. else : //* if no posts exist
  76. do_action( 'genesis_loop_else' );
  77. endif; //* end loop
  78. do_action( 'genesis_after_loop' );
  79.  
  80. // Reset postdata
  81. wp_reset_postdata();
  82.  
  83. genesis_markup( array(
  84.         'html5' => '</main>', //* end .content
  85.         'xhtml' => '</div>', //* end #content
  86.         ) );
  87.        
  88. do_action( 'genesis_after_content' );
  89.  
  90. echo '</div>'; //* end .content-sidebar-wrap or #content-sidebar-wrap
  91.  
  92. do_action( 'genesis_after_content_sidebar_wrap' );
  93.  
  94. get_footer ();
  95.  
  96. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top