Guest User

loop.php

a guest
Oct 2nd, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.00 KB | None | 0 0
  1. <?php
  2. global $graphene_settings;
  3. $post_type = get_post_type_object( get_post_type() );
  4. ?>
  5. <?php
  6. /**
  7. * Check if the post has a post format. Load a post-format specific loop file,
  8. * if it has. Continue with standard loop otherwise.
  9. */
  10. if ( function_exists( 'get_post_format' ) && $post_type->name != 'page' ) {
  11. global $post_format;
  12. $post_format = get_post_format();
  13.  
  14. // Get the post formats supported by the theme
  15. $supported_formats = get_theme_support( 'post-formats' );
  16. if ( is_array( $supported_formats ) ) $supported_formats = $supported_formats[0];
  17.  
  18. if ( in_array( $post_format, $supported_formats ) ) {
  19.  
  20. // Get the post format loop file
  21. get_template_part( 'loop-post-formats', $post_format );
  22.  
  23. // Stop this default posts loop
  24. return;
  25. }
  26. }
  27. ?>
  28.  
  29. <?php if ( $post_type->name == 'page' && $graphene_settings['hide_parent_content_if_empty'] && $post->post_content == '' ) : ?>
  30. <h1 class="page-title">
  31. <?php if ( get_the_title() == '' ) { _e( '(No title)', 'graphene' ); } else { the_title(); } ?>
  32. </h1>
  33. <?php else : ?>
  34. <div id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix post' ); ?>>
  35.  
  36. <?php do_action( 'graphene_before_post' ); ?>
  37.  
  38. <div class="entry clearfix">
  39.  
  40. <?php /* Post date is not shown if this is a Page post */ ?>
  41. <?php if ( stristr( graphene_post_date_setting( get_the_ID() ), 'icon' ) ) graphene_post_date(); ?>
  42.  
  43. <?php /* Show the post author's gravatar if enabled */
  44. if ( $graphene_settings['show_post_avatar'] ) {
  45. echo '<div class="post-avatar-wrap gutter-left">' . get_avatar( get_the_author_meta( 'user_email' ), 45 ) . '</div>';
  46. }
  47. ?>
  48.  
  49. <?php
  50. /* Add a print button only for single pages/posts
  51. * and if enabled in the theme option.
  52. */
  53. if ( $graphene_settings['print_button'] && is_singular() ) : ?>
  54. <?php graphene_print_button(); ?>
  55. <?php endif; ?>
  56.  
  57. <?php /* Add an email post icon if the WP-Email plugin is installed and activated */
  58. if( function_exists( 'wp_email' ) && is_singular() ) { echo '<p class="email wp-email-button">'; email_link(); echo '</p>'; }
  59. ?>
  60.  
  61. <?php /* Post title */ ?>
  62. <h2 class="post-title entry-title">
  63. <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( esc_attr__( 'Permalink to %s', 'graphene' ), the_title_attribute( 'echo=0' ) ); ?>">
  64. <?php if ( get_the_title() == '' ) { _e( '(No title)', 'graphene' ); } else { the_title(); } ?>
  65. </a>
  66. <?php do_action( 'graphene_post_title' ); ?>
  67. </h2>
  68.  
  69.  
  70. <?php /* Post meta */ ?>
  71. <?php if ( $post_type->name != 'page' || is_user_logged_in() ) : ?>
  72. <div class="post-meta clearfix">
  73.  
  74. <?php /* Post category, not shown if admin decides to hide it */ ?>
  75. <?php if ( ( $graphene_settings['hide_post_cat'] != true ) ) : ?>
  76. <span class="printonly"><?php _e( 'Categories:', 'graphene' ); ?> </span>
  77. <p class="meta_categories"><?php the_category( ", " ); ?></p>
  78. <?php endif; ?>
  79.  
  80. <?php /* Edit post link, if user is logged in */ ?>
  81. <?php if ( is_user_logged_in() ) : ?>
  82. <p class="edit-post">
  83. <?php edit_post_link( sprintf( __( 'Edit %s', 'graphene' ), $post_type->labels->singular_name ), ' (', ')' ); ?>
  84. </p>
  85. <?php endif; ?>
  86.  
  87. <?php /* Inline post date */ ?>
  88. <?php if ( graphene_post_date_setting( get_the_ID() ) == 'text' ) graphene_post_date(); ?>
  89.  
  90. <?php /* Post author, not shown if this is a Page post or if admin decides to hide it */ ?>
  91. <?php if ( $post_type->name != 'page' && $graphene_settings['hide_post_author'] != true ) : ?>
  92. <p class="post-author author vcard">
  93. <?php
  94. /* translators: this is for the author byline, such as 'by John Doe' */
  95. $author_url = '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '" class="url" rel="author">' . get_the_author_meta( 'display_name' ) . '</a>';
  96. printf( __( 'by %s', 'graphene' ), '<span class="fn nickname">' . apply_filters( 'graphene_author_url', $author_url ) . '</span>' );
  97. ?>
  98. </p>
  99. <?php endif; ?>
  100.  
  101. <?php /* For printing: the date of the post */
  102. if ( $graphene_settings['print_css'] && graphene_should_show_date() ) {
  103. echo graphene_print_only_text( get_the_time( get_option( 'date_format' ) ) );
  104. }
  105. ?>
  106.  
  107. <?php do_action( 'graphene_post_meta' ); ?>
  108. </div>
  109. <?php endif; ?>
  110.  
  111. <?php /* Post content */ ?>
  112. <div class="entry-content clearfix">
  113. <?php do_action( 'graphene_before_post_content' ); ?>
  114.  
  115. <?php if ( ( is_home() && !$graphene_settings['posts_show_excerpt'] ) || is_singular() || ( ! is_singular() && ! is_home() && $graphene_settings['archive_full_content'] ) ) : ?>
  116.  
  117. <?php /* Social sharing buttons at top of post */ ?>
  118. <?php if ( stripos( $graphene_settings['addthis_location'], 'top' ) !== false) { graphene_addthis( get_the_ID() ); } ?>
  119.  
  120. <?php /* The full content */ ?>
  121. <?php the_content( '<span class="block-button">' . __( 'Read the rest of this entry &raquo;', 'graphene' ) . '</span>' ); ?>
  122.  
  123. <?php else : ?>
  124.  
  125. <?php /* The post thumbnail */
  126. if ( has_post_thumbnail( get_the_ID() ) ) { ?>
  127. <div class="excerpt-thumb">
  128. <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( esc_attr__( 'Permalink to %s', 'graphene' ), the_title_attribute( 'echo=0' ) ); ?>">
  129. <?php the_post_thumbnail( apply_filters( 'graphene_excerpt_thumbnail_size', 'thumbnail' ) ); ?>
  130. </a>
  131. </div>
  132. <?php
  133. } else {
  134. echo graphene_get_post_image( get_the_ID(), apply_filters( 'graphene_excerpt_thumbnail_size', 'thumbnail' ), 'excerpt' );
  135. }
  136. ?>
  137.  
  138. <?php /* Social sharing buttons at top of post */ ?>
  139. <?php if ( stripos( $graphene_settings['addthis_location'], 'top' ) !== false && $graphene_settings['show_addthis_archive'] ) { graphene_addthis( get_the_ID() ); } ?>
  140.  
  141. <?php /* The excerpt */ ?>
  142. <?php the_excerpt(); ?>
  143.  
  144. <?php endif; ?>
  145.  
  146. <?php wp_link_pages( array( 'before' => '<div class="link-pages"><p><strong>' . __( 'Pages:','graphene' ) . '</strong> ', 'after' => '</p></div>', 'next_or_number' => 'number' ) ); ?>
  147.  
  148. <?php do_action( 'graphene_after_post_content' ); ?>
  149.  
  150. </div>
  151.  
  152. <?php /* Post footer */ ?>
  153. <div class="entry-footer clearfix">
  154. <?php /* Display the post's tags, if there is any */ ?>
  155. <?php if ( $post_type->name != 'page' && ( $graphene_settings['hide_post_tags'] != true) ) : ?>
  156. <p class="post-tags"><?php if ( has_tag() ) { _e( 'Tags:', 'graphene' ); the_tags( ' ', ', ', '' ); } else { _e( 'This post has no tag','graphene' ); } ?></p>
  157. <?php endif; ?>
  158.  
  159. <?php /* Display comments popup link. */ ?>
  160. <?php if ( graphene_should_show_comments() ) : ?>
  161. <p class="comment-link">
  162. <?php
  163. $comments_num = get_comments_number();
  164. comments_popup_link( __( 'Leave comment', 'graphene' ), sprintf( __( '%s comment', 'graphene' ), number_format_i18n( $comments_num ) ), sprintf( _n( '%s comment', '%s comments', $comments_num, 'graphene' ), number_format_i18n( $comments_num ) ), 'comments-link' );
  165. ?>
  166. </p>
  167. <?php endif; ?>
  168.  
  169. <?php
  170. /* Display AddThis social sharing button */
  171. if ( stripos( $graphene_settings['addthis_location'], 'bottom' ) !== false && $graphene_settings['show_addthis_archive'] ) { graphene_addthis( get_the_ID() ); }
  172. ?>
  173.  
  174. <?php do_action( 'graphene_post_footer' ); ?>
  175. </div>
  176. </div>
  177. </div>
  178. <?php endif; ?>
  179.  
  180. <?php /* For printing: the permalink */
  181. if ( $graphene_settings['print_css']) {
  182. echo graphene_print_only_text( '<span class="printonly url"><strong>' .__( 'Permanent link to this article:', 'graphene' ). ' </strong><span>' . get_permalink(). '</span></span>' );
  183. }
  184. ?>
  185.  
  186. <?php /* Display Adsense advertising */ ?>
  187. <?php if ( ! is_front_page() || ( is_front_page() && $graphene_settings['adsense_show_frontpage'] ) ) { graphene_adsense(); } ?>
  188.  
  189. <?php do_action( 'graphene_loop_footer' ); ?>
Advertisement
Add Comment
Please, Sign In to add comment