Advertisement
Guest User

Twenty Twelve Sticky On The Bottom

a guest
Feb 8th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3. <div id="primary" class="site-content">
  4. <div id="content" role="main">
  5. <?php
  6. // don't edit this
  7. global $wp_query;
  8. $first_page_total= 9; // total number of posts on first page
  9. $paginated_total = 10;
  10. $found_posts = $wp_query->found_posts;
  11. $pages = 1 + ceil(($found_posts - $first_page_total) / $paginated_total);
  12. $wp_query->max_num_pages = $pages;
  13. // start editing
  14. ?>
  15. <?php if ( have_posts() ) : ?>
  16.  
  17. <?php /* Start the Loop */ ?>
  18. <?php while ( have_posts() ) : the_post(); ?>
  19. <?php get_template_part( 'content', get_post_format() ); ?>
  20. <?php endwhile; ?>
  21.  
  22. <?php if(!is_paged()) : ?>
  23. <?php
  24. $sticky = get_option( 'sticky_posts' );
  25. $args = array(
  26. 'posts_per_page' => 1,
  27. 'post__in' => $sticky,
  28. 'ignore_sticky_posts' => 1
  29. );
  30. $the_query = new WP_Query( $args); ?>
  31. <?php /* Start the sticky post loop */ ?>
  32. <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
  33. <?php
  34. if ( $sticky[0] ) {
  35. get_template_part( 'content', get_post_format() );
  36. }
  37. ?>
  38. <?php endwhile; ?>
  39. <?php endif; ?>
  40.  
  41. <?php twentytwelve_content_nav( 'nav-below' ); ?>
  42.  
  43. <?php else : ?>
  44.  
  45. <article id="post-0" class="post no-results not-found">
  46.  
  47. <?php if ( current_user_can( 'edit_posts' ) ) :
  48. // Show a different message to a logged-in user who can add posts.
  49. ?>
  50. <header class="entry-header">
  51. <h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
  52. </header>
  53.  
  54. <div class="entry-content">
  55. <p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
  56. </div><!-- .entry-content -->
  57.  
  58. <?php else :
  59. // Show the default message to everyone else.
  60. ?>
  61. <header class="entry-header">
  62. <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
  63. </header>
  64.  
  65. <div class="entry-content">
  66. <p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
  67. <?php get_search_form(); ?>
  68. </div><!-- .entry-content -->
  69. <?php endif; // end current_user_can() check ?>
  70.  
  71. </article><!-- #post-0 -->
  72.  
  73. <?php endif; // end have_posts() check ?>
  74.  
  75. </div><!-- #content -->
  76. </div><!-- #primary -->
  77.  
  78. <?php get_sidebar(); ?>
  79. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement