Advertisement
alchymyth

'page of posts' page template for graphene

Apr 20th, 2011
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.18 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: PageOfPosts
  4. */
  5. /*
  6. specific for Graphene theme
  7. */
  8. global $graphene_settings;
  9. get_header(); ?>
  10.  
  11. <?php
  12. // page id 34 will get category ID 6 posts, page 16 will get category 32 posts, page 28 will get category 17 posts
  13. if (is_page('9') ) {
  14. $cat = array(13);
  15. } elseif ( is_page('11') ) {
  16. $cat = array(6);
  17. } elseif ( is_page('2') ) {
  18. $cat = array(3);
  19. } elseif ( is_page('6') ) {
  20. $cat = array(4);
  21. } elseif ( is_page('8') ) {
  22. $cat = array(5);
  23. } elseif ( is_page('20') ) {
  24. $cat = array(7);
  25. } else {
  26. $cat = '';
  27. }
  28.  
  29. $showposts = -1; // -1 shows all posts
  30. $do_not_show_stickies = 1; // 0 to show stickies
  31. $args=array(
  32. 'category__in' => $cat,
  33. 'showposts' => $showposts,
  34. 'caller_get_posts' => $do_not_show_stickies
  35. );
  36. $my_query = new WP_Query($args);
  37.  
  38. ?>
  39.  
  40. <?php if( $my_query->have_posts() ) : ?>
  41.  
  42. <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
  43.  
  44. <?php
  45. //necessary to show the tags
  46. global $wp_query;
  47. $wp_query->in_the_loop = true;
  48. ?>
  49.  
  50. <?php global $graphene_settings; ?>
  51.  
  52. <div id="post-<?php the_ID(); ?>" <?php post_class('clearfix post'); ?>>
  53.  
  54. <?php /* Post date is not shown if this is a Page post */ ?>
  55.  
  56. <div class="date">
  57. <p class="default_date"><?php the_time('M'); ?><br /><span><?php the_time('d') ?></span>
  58. <?php if ($graphene_settings['post_date_display'] == 'icon_plus_year') : ?>
  59. <br /><span class="year"><?php the_time('Y'); ?></span>
  60. <?php endif; ?>
  61. </p>
  62.  
  63. <?php do_action('graphene_post_date'); ?>
  64. </div>
  65.  
  66. <div class="entry clearfix">
  67.  
  68. <?php /* Post title */ ?>
  69. <h2 class="post-title">
  70. <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(esc_attr__('Permalink to %s', 'graphene'), the_title_attribute('echo=0')); ?>"><?php if (get_the_title() == '') {_e('(No title)','graphene');} else {the_title();} ?></a>
  71. <?php do_action('graphene_post_title'); ?>
  72. </h2>
  73.  
  74. <?php /* Post meta */ ?>
  75.  
  76. <div class="post-meta clearfix">
  77.  
  78. <ul class="meta_categories">
  79. <li><?php the_category(",</li>\n<li>") ?></li>
  80. </ul>
  81.  
  82. <?php /* Edit post link, if user is logged in */ ?>
  83. <?php if (is_user_logged_in()) : ?>
  84. <p class="edit-post">
  85. <?php edit_post_link(__('Edit post','graphene'), ' (', ')'); ?>
  86. </p>
  87. <?php endif; ?>
  88.  
  89. <?php /* Inline post date */
  90. if ($graphene_settings['post_date_display'] == 'text' && !is_page()){
  91. echo '<p class="post-date-inline">';
  92. the_time(get_option('date_format'));
  93. echo '</p>';
  94. }
  95. ?>
  96.  
  97. <?php /* Post author, not not shown if this is a Page post or if admin decides to hide it */ ?>
  98. <?php if ($graphene_settings['hide_post_author'] != true) : ?>
  99. <p class="post-author">
  100. <?php _e('by','graphene'); echo ' '; the_author_posts_link(); ?>
  101. </p>
  102. <?php endif; ?>
  103.  
  104. <?php do_action('graphene_post_meta'); ?>
  105. </div>
  106.  
  107. <?php /* Post content */ ?>
  108. <div class="entry-content clearfix">
  109. <?php do_action('graphene_before_post_content'); ?>
  110.  
  111. <?php the_content('<span class="block-button">'.__('Read the rest of this entry &raquo;','graphene').'</span>'); ?>
  112.  
  113. <?php wp_link_pages(array('before' => __('<div class="link-pages"><p><strong>Pages:</strong> ','graphene'), 'after' => '</p></div>', 'next_or_number' => 'number')); ?>
  114.  
  115. <?php do_action('graphene_after_post_content'); ?>
  116.  
  117. </div>
  118.  
  119. <?php /* Post footer */ ?>
  120. <div class="entry-footer clearfix">
  121. <?php /* Display the post's tags, if there is any */ ?>
  122. <?php if ( ($graphene_settings['hide_post_tags'] != true)) : ?>
  123. <p class="post-tags"><?php if (has_tag()) {_e('Tags:','graphene'); the_tags(' ', ', ', '');} else {_e('This post has no tag','graphene');} ?></p>
  124. <?php endif; ?>
  125.  
  126. <?php
  127. /**
  128. * Display AddThis social sharing button if single post page, comments popup link otherwise.
  129. * See the graphene_addthis() function in functions.php
  130. */
  131. ?>
  132. <?php if (is_single() || is_page()) : ?>
  133. <?php graphene_addthis(get_the_ID()); ?>
  134. <?php elseif ($graphene_settings['hide_post_commentcount'] != true && comments_open()) : ?>
  135. <p class="comment-link"><?php comments_popup_link(__('Leave comment','graphene'), __('1 comment','graphene'), __("% comments",'graphene')); ?></p>
  136. <?php endif; ?>
  137.  
  138. <?php do_action('graphene_post_footer'); ?>
  139. </div>
  140. </div>
  141. </div>
  142.  
  143. <?php
  144. /**
  145. * Display Adsense advertising for single post pages
  146. * See graphene_adsense() function in functions.php
  147. */
  148. ?>
  149. <?php if (is_single() || is_page() || (is_front_page() && $graphene_settings['adsense_show_frontpage']) || is_archive() || is_search()) {graphene_adsense();} ?>
  150.  
  151. <?php endwhile; ?>
  152.  
  153. <?php /* Display posts navigation if this is not a single post page */ ?>
  154. <?php if (!is_single()) : ?>
  155. <?php /* Posts navigation. See functions.php for the function definition */ ?>
  156. <?php graphene_posts_nav(); ?>
  157. <?php endif; ?>
  158.  
  159. <?php /* If there is no post, display message and search form */ ?>
  160. <?php else : ?>
  161. <div class="post page">
  162. <h2><?php _e('Not found','graphene'); ?></h2>
  163. <div class="entry-content">
  164. <p>
  165. <?php
  166. if (!is_search())
  167. _e("Sorry, but you are looking for something that isn't here. Wanna try a search?","graphene");
  168. else
  169. _e("Sorry, but no results were found for that keyword. Wanna try an alternative keyword search?","graphene");
  170. ?>
  171.  
  172. </p>
  173. <?php get_search_form(); ?>
  174. </div>
  175. </div>
  176.  
  177. <?php do_action('graphene_not_found'); ?>
  178. <?php endif; ?>
  179.  
  180. <?php do_action('graphene_bottom_content'); ?>
  181.  
  182. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement