Advertisement
Guest User

Responsive blog.php

a guest
Mar 8th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. <?php
  2.  
  3. // Exit if accessed directly
  4. if ( !defined('ABSPATH')) exit;
  5.  
  6. ?>
  7. <?php get_header(); ?>
  8.  
  9. <?php global $more; $more = 0; ?>
  10.  
  11. <div id="content-blog" class="grid col-620">
  12.  
  13. <?php $options = get_option('responsive_theme_options'); ?>
  14. <?php if ($options['breadcrumb'] == 0): ?>
  15. <?php echo responsive_breadcrumb_lists(); ?>
  16. <?php endif; ?>
  17.  
  18. <?php
  19. if ( get_query_var('paged') )
  20. $paged = get_query_var('paged');
  21. elseif ( get_query_var('page') )
  22. $paged = get_query_var('page');
  23. else
  24. $paged = 1;
  25. query_posts("post_type=post&paged=$paged");
  26. ?>
  27.  
  28.  
  29. <?php
  30. // don't edit this
  31. global $wp_query;
  32. $first_page_total= 9; // total number of posts on first page
  33. $paginated_total = 10;
  34. $found_posts = $wp_query->found_posts;
  35. $pages = 1 + ceil(($found_posts - $first_page_total) / $paginated_total);
  36. $wp_query->max_num_pages = $pages;
  37. // start editing
  38. ?>
  39. <?php /* Start the Loop */ ?>
  40. <?php if ( have_posts() ) : ?>
  41. <?php while ( have_posts() ) : the_post(); ?>
  42. <?php get_template_part( 'content', get_post_format() ); ?>
  43. <?php endwhile; ?>
  44. <?php if(!is_paged()) : ?>
  45. <?php
  46. $sticky = get_option( 'sticky_posts' );
  47. $args = array(
  48. 'posts_per_page' => 1,
  49. 'post__in' => $sticky,
  50. 'ignore_sticky_posts' => 1
  51. );
  52. $the_query = new WP_Query( $args); ?>
  53. <?php /* Start the sticky post loop */ ?>
  54. <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
  55. <?php
  56. if ( $sticky[0] ) {
  57. get_template_part( 'content', get_post_format() );
  58. }
  59. ?>
  60. <?php endwhile; ?>
  61. <?php endif; ?>
  62. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  63. <div class="navigation">
  64. <div class="previous"><?php next_posts_link( __( '&#8249; Older posts', 'responsive' ) ); ?></div>
  65. <div class="next"><?php previous_posts_link( __( 'Newer posts &#8250;', 'responsive' ) ); ?></div>
  66. </div><!-- end of .navigation -->
  67. <?php endif; ?>
  68.  
  69. <?php else : ?>
  70.  
  71. <h1 class="title-404"><?php _e('404 &#8212; Fancy meeting you here!', 'responsive'); ?></h1>
  72.  
  73. <p><?php _e('Don&#39;t panic, we&#39;ll get through this together. Let&#39;s explore our options here.', 'responsive'); ?></p>
  74.  
  75. <h6><?php printf( __('You can return %s or search for the page you were looking for.', 'responsive'),
  76. sprintf( '<a href="%1$s" title="%2$s">%3$s</a>',
  77. esc_url( get_home_url() ),
  78. esc_attr__('Home', 'responsive'),
  79. esc_attr__('&larr; Home', 'responsive')
  80. ));
  81. ?></h6>
  82.  
  83. <?php get_search_form(); ?>
  84.  
  85. <?php endif; ?>
  86.  
  87. </div><!-- end of #content-blog -->
  88.  
  89. <?php get_sidebar(); ?>
  90. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement