Advertisement
Artisantopia

index.php

May 2nd, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. <?php
  2. /**
  3. * The main template file.
  4. *
  5. * WARNING: This template file is a core part of the
  6. * Theme Blvd WordPress Framework. This framework is
  7. * designed around this file NEVER being altered. It
  8. * is advised that any edits to the way this file
  9. * displays its content be done with via hooks and filters.
  10. *
  11. * @author Jason Bobich
  12. * @copyright Copyright (c) Jason Bobich
  13. * @link http://jasonbobich.com
  14. * @link http://themeblvd.com
  15. * @package Theme Blvd WordPress Framework
  16. */
  17. global $_themeblvd_config;
  18. //echo '<pre>'; print_r($_themeblvd_config); echo "</pre>";
  19. $homepage_content = themeblvd_get_option( 'homepage_content', null, 'posts' );
  20. $content = themeblvd_get_option( 'blog_content' );
  21.  
  22. // In displaying the homepage, we need to first figure out if a custom layout
  23. // should show or we're going to list out posts. If the user were to apply a
  24. // custom layout to a static page, and then set that as the frontpage under
  25. // Settings > Reading > Frontpage displays, any paginated elements in the
  26. // layout will not work right. So, to combat this, it's setup that the user
  27. // can select a custom layout from their Theme Options page and leave their
  28. // frontpage displays option to "your latest posts."
  29.  
  30. if( $homepage_content == 'custom_layout' ) {
  31.  
  32. /*------------------------------------------------------*/
  33. /* Custom Layout Homepage
  34. /*------------------------------------------------------*/
  35.  
  36. get_template_part( 'template_builder' );
  37.  
  38. } else {
  39.  
  40. // Template part
  41. $template_part = themeblvd_get_part( 'index' );
  42.  
  43. // Setup
  44. if( $template_part == 'grid' || $template_part == 'index_grid' ) {
  45.  
  46. /*------------------------------------------------------*/
  47. /* Magazine Homepage setup (post grid)
  48. /*------------------------------------------------------*/
  49.  
  50. // Columns
  51. $columns = themeblvd_get_option( 'index_grid_columns' );
  52. if( ! $columns ) $columns = apply_filters( 'themeblvd_default_grid_columns', 3 );
  53. // Rows
  54. $rows = themeblvd_get_option( 'index_grid_rows' );
  55. if( ! $rows ) $rows = apply_filters( 'themeblvd_default_grid_columns', 4 );
  56. // Thumbnail size
  57. $size = themeblvd_grid_class( $columns );
  58. // Re-Build query string
  59. $query_string = '';
  60. // Categories
  61. $exclude = themeblvd_get_option( 'index_grid_categories' );
  62. if( $exclude ) {
  63. $categories = 'cat=';
  64. foreach( $exclude as $key => $value )
  65. if( $value )
  66. $categories .= '-'.$key.',';
  67. $categories = themeblvd_remove_trailing_char( $categories, ',' );
  68. }
  69. if( isset( $categories ) )
  70. $query_string .= $categories;
  71. // Posts per page
  72. $query_string .= 'posts_per_page='.get_option( 'posts_per_page' ).'&';
  73. // Pagination
  74. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  75. $query_string .= $paged;
  76.  
  77. } else {
  78.  
  79. /*------------------------------------------------------*/
  80. /* Standard Blog Homepage setup (post list)
  81. /*------------------------------------------------------*/
  82.  
  83. $query_string = themeblvd_query_string();
  84. $content = themeblvd_get_option( 'blog_content' );
  85.  
  86. }
  87.  
  88. // Header
  89. get_header();
  90.  
  91. // Featured area
  92. if( themeblvd_config( 'featured' ) ) {
  93. themeblvd_featured_start();
  94. themeblvd_featured( 'blog' );
  95. themeblvd_featured_end();
  96. }
  97.  
  98. // Start main area
  99. themeblvd_main_start();
  100. themeblvd_main_top();
  101.  
  102. // Breadcrumbs
  103. themeblvd_breadcrumbs();
  104.  
  105. // Before sidebar+content layout
  106. themeblvd_before_layout();
  107. ?>
  108.  
  109. <div id="sidebar_layout">
  110. <div class="sidebar_layout-inner">
  111. <div class="grid-protection">
  112.  
  113. <?php themeblvd_fixed_sidebars( 'left' ); ?>
  114.  
  115. <!-- CONTENT (start) -->
  116.  
  117. <div id="content" role="main">
  118. <div class="inner">
  119. <?php themeblvd_content_top(); ?>
  120. <?php if( $template_part == 'grid' || $template_part == 'index_grid' ) : ?>
  121.  
  122. <!-- HOMEPAGE POST GRID (start) -->
  123.  
  124. <div class="primary-post-grid post_grid_paginated post_grid">
  125. <div class="grid-protection">
  126. <?php
  127. query_posts( $query_string );
  128. $counter = 1;
  129. if ( have_posts() ) {
  130. while ( have_posts() ) {
  131. the_post();
  132. if( $counter == 1 ) themeblvd_open_row();
  133. get_template_part( 'content', $template_part );
  134. if( $counter % $columns == 0 ) themeblvd_close_row();
  135. if( $counter % $columns == 0 && $posts_per_page != $counter ) themeblvd_open_row();
  136. $counter++;
  137. }
  138. if( ($counter-1) != $posts_per_page ) themeblvd_close_row();
  139. } else {
  140. echo '<p>'.themeblvd_get_local( 'archive_no_posts' ).'</p>';
  141. }
  142. ?>
  143. </div><!-- .grid-protection (end) -->
  144. <?php themeblvd_pagination(); ?>
  145. </div><!-- .post_grid (end) -->
  146.  
  147. <!-- HOMEPAGE POST GRID (end) -->
  148.  
  149. <?php else : ?>
  150.  
  151. <!-- HOMEPAGE POST LIST (start) -->
  152.  
  153. <div class="primary-post-list post_list_paginated post_list">
  154. <?php query_posts( $query_string ); ?>
  155. <?php if ( have_posts() ) : ?>
  156. <?php while ( have_posts() ) : the_post(); ?>
  157. <?php get_template_part( 'content', themeblvd_get_part( 'index' ) ); ?>
  158. <?php endwhile; ?>
  159. <?php else : ?>
  160. <p><?php echo themeblvd_get_local( 'archive_no_posts' ); ?></p>
  161. <?php endif; ?>
  162. <?php themeblvd_pagination(); ?>
  163. </div><!-- .blogroll (end) -->
  164.  
  165. <!-- HOMEPAGE POST LIST (end) -->
  166.  
  167. <?php endif; ?>
  168. </div><!-- .inner (end) -->
  169. </div><!-- #content (end) -->
  170.  
  171. <!-- CONTENT (end) -->
  172.  
  173. <?php themeblvd_fixed_sidebars( 'right' ); ?>
  174.  
  175. </div><!-- .grid-protection (end) -->
  176. </div><!-- .sidebar_layout-inner (end) -->
  177. </div><!-- .sidebar-layout-wrapper (end) -->
  178.  
  179. <?php
  180. // End main area
  181. themeblvd_main_bottom();
  182. themeblvd_main_end();
  183.  
  184. // Footer
  185. get_footer();
  186.  
  187. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement