Advertisement
Guest User

Untitled

a guest
Dec 27th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.59 KB | None | 0 0
  1. <?php
  2. /**
  3. * Single post content actions
  4. *
  5. *
  6. * @package Customizr
  7. * @subpackage classes
  8. * @since 3.0.5
  9. * @author Nicolas GUILLAUME <nicolas@themesandco.com>
  10. * @copyright Copyright (c) 2013, Nicolas GUILLAUME
  11. * @link http://themesandco.com/customizr
  12. * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  13. */
  14.  
  15. class TC_post {
  16.  
  17. //Access any method or var of the class with classname::$instance -> var or method():
  18. static $instance;
  19.  
  20. function __construct () {
  21.  
  22. self::$instance =& $this;
  23.  
  24. //posts parts actions
  25. add_action ( '__before_content' , array( $this , 'tc_post_header' ));
  26. add_action ( '__after_content' , array( $this , 'tc_post_footer' ));
  27.  
  28. //add post header, content and footer to the __loop
  29. add_action ( '__loop' , array( $this , 'tc_post_content' ));
  30.  
  31. //selector filter
  32. add_filter ( '__article_selectors' , array( $this , 'tc_post_selectors' ));
  33. }
  34.  
  35.  
  36.  
  37.  
  38. /**
  39. * Displays the conditional selectors of the article
  40. *
  41. * @package Customizr
  42. * @since 3.0.10
  43. */
  44. function tc_post_selectors () {
  45. //check conditional tags : we want to show single post or single custom post types
  46. global $post;
  47. if ( !isset($post) )
  48. return;
  49. if ( 'page' == $post -> post_type || 'attachment' == $post -> post_type || !is_singular() )
  50. return;
  51.  
  52. tc__f('rec' , __FILE__ , __FUNCTION__, __CLASS__ );
  53.  
  54. echo 'id="post-'.get_the_ID().'" '.tc__f('__get_post_class' , 'row-fluid');
  55. }
  56.  
  57.  
  58.  
  59.  
  60. /**
  61. * The template part for displaying the single posts header
  62. *
  63. * @package Customizr
  64. * @since Customizr 3.0
  65. */
  66. function tc_post_header() {
  67. //check conditional tags : we want to show single post or single custom post types
  68. global $post;
  69. if ( 'page' == $post -> post_type || 'attachment' == $post -> post_type || !is_singular() )
  70. return;
  71. if ( tc__f( '__is_home_empty') )
  72. return;
  73. if( in_array( get_post_format(), tc__f('post_type_with_no_headers') ) )
  74. return;
  75.  
  76. tc__f('rec' , __FILE__ , __FUNCTION__, __CLASS__ );
  77.  
  78. ob_start();
  79.  
  80. ?>
  81.  
  82. <?php tc__f( 'tip' , __FUNCTION__ , __CLASS__, __FILE__ ); ?>
  83.  
  84. <header class="entry-header">
  85. <!-- hidden comment -->
  86.  
  87. <?php
  88. $bubble_style = ( 0 == get_comments_number() ) ? 'style="color:#ECECEC" ':'';
  89.  
  90. printf( '<h1 class="entry-title format-icon">%1$s %2$s %3$s</h1>' ,
  91. get_the_title(),
  92. ( comments_open() && get_comments_number() != 0 && !post_password_required() ) ? '<span class="comments-link">
  93. <a href="'.get_permalink().'#tc-comment-title" title="'.__( 'Comment(s) on ' , 'customizr' ).get_the_title().'"><span '.$bubble_style.' class="fs1 icon-bubble"></span><span class="inner">'.get_comments_number().'</span></a>
  94. </span>' : '',
  95. ((is_user_logged_in()) && current_user_can('edit_posts')) ? '<span class="edit-link btn btn-inverse btn-mini"><a class="post-edit-link" href="'.get_edit_post_link().'" title="'.__( 'Edit' , 'customizr' ).'">'.__( 'Edit' , 'customizr' ).'</a></span>' : ''
  96. );
  97.  
  98. ?>
  99.  
  100.  
  101. </header><!-- .entry-header -->
  102. <?php
  103. $html = ob_get_contents();
  104. ob_end_clean();
  105.  
  106. echo apply_filters( 'tc_post_header', $html);
  107. }
  108.  
  109.  
  110.  
  111. /**
  112. * The default template for displaying single post content
  113. *
  114. * @package Customizr
  115. * @since Customizr 3.0
  116. */
  117. function tc_post_content() {
  118. //check conditional tags : we want to show single post or single custom post types
  119. global $post;
  120. if ( !isset($post) )
  121. return;
  122. if ( 'page' == $post -> post_type || 'attachment' == $post -> post_type || !is_singular() )
  123. return;
  124. if ( tc__f( '__is_home_empty') )
  125. return;
  126.  
  127. tc__f('rec' , __FILE__ , __FUNCTION__, __CLASS__ );
  128.  
  129. //display an icon for div if there is no title
  130. $icon_class = in_array(get_post_format(), array( 'quote' , 'aside' , 'status' , 'link' )) ? 'format-icon':'';
  131.  
  132. ob_start();
  133. ?>
  134.  
  135. <?php do_action( '__before_content' ); ?>
  136.  
  137. <?php echo '<hr class="featurette-divider">' ?>
  138.  
  139. <?php tc__f( 'tip' , __FUNCTION__ , __CLASS__, __FILE__ ); ?>
  140.  
  141. <section class="entry-content <?php echo $icon_class ?>">
  142. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>' , 'customizr' ) ); ?>
  143. <?php wp_link_pages( array( 'before' => '<div class="pagination pagination-centered">' . __( 'Pages:' , 'customizr' ), 'after' => '</div>' ) ); ?>
  144. </section><!-- .entry-content -->
  145.  
  146. <?php do_action( '__after_content' ) ?>
  147.  
  148. <?php
  149. $html = ob_get_contents();
  150. ob_end_clean();
  151.  
  152. echo apply_filters( 'tc_post_content', $html );
  153. }
  154.  
  155.  
  156.  
  157.  
  158. /**
  159. * The template part for displaying the posts footer
  160. *
  161. * @package Customizr
  162. * @since Customizr 3.0
  163. */
  164. function tc_post_footer() {
  165. //check conditional tags : we want to show single post or single custom post types
  166. global $post;
  167. if ( 'page' == $post -> post_type || 'attachment' == $post -> post_type || !is_singular() )
  168. return;
  169.  
  170. if ( !is_singular() )
  171. return;
  172.  
  173. tc__f('rec' , __FILE__ , __FUNCTION__, __CLASS__ );
  174.  
  175. ob_start();
  176. ?>
  177. <footer class="entry-meta">
  178. <div class="entry-meta">
  179.  
  180. <?php //meta not displayed on home page, only in archive or search pages
  181. if ( !tc__f('__is_home') ) {
  182. do_action( '__post_metas' );
  183. }
  184. ?>
  185.  
  186. </div><!-- .entry-meta -->
  187. <?php if ( is_singular() && get_the_author_meta( 'description' ) ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>
  188. <hr class="featurette-divider">
  189. <div class="author-info">
  190. <div class="row-fluid">
  191. <div class="comment-avatar author-avatar span2">
  192. <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'tc_author_bio_avatar_size' , 100 ) ); ?>
  193. </div><!-- .author-avatar -->
  194. <div class="author-description span10">
  195. <?php tc__f( 'tip' , __FUNCTION__ , __CLASS__, __FILE__ ); ?>
  196.  
  197. <h2><?php printf( __( 'About %s' , 'customizr' ), get_the_author() ); ?></h2>
  198. <p><?php the_author_meta( 'description' ); ?></p>
  199.  
  200. <div class="author-link">
  201. <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
  202. <?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>' , 'customizr' ), get_the_author() ); ?>
  203. </a>
  204. </div><!-- .author-link -->
  205. </div><!-- .author-description -->
  206. </div>
  207. </div><!-- .author-info -->
  208.  
  209. <?php endif; ?>
  210.  
  211. </footer><!-- .entry-meta -->
  212. <?php
  213. $html = ob_get_contents();
  214. ob_end_clean();
  215.  
  216. echo apply_filters( 'tc_post_footer', $html );
  217. }
  218.  
  219. }//end of class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement