Advertisement
Guest User

Untitled

a guest
Mar 1st, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.74 KB | None | 0 0
  1. <?php
  2. global $avia_config, $post_loop_count;
  3.  
  4.  
  5. if(empty($post_loop_count)) $post_loop_count = 1;
  6. $blog_style = !empty($avia_config['blog_style']) ? $avia_config['blog_style'] : avia_get_option('blog_style','multi-big');
  7. if(is_single()) $blog_style = avia_get_option('single_post_style','single-big');
  8. $blog_content = !empty($avia_config['blog_content']) ? $avia_config['blog_content'] : "content";
  9. $initial_id = avia_get_the_ID();
  10.  
  11. // check if we got posts to display:
  12. if (have_posts()) :
  13.  
  14. while (have_posts()) : the_post();
  15.  
  16. /*
  17. * get the current post id, the current post class and current post format
  18. */
  19. $url = "";
  20. $current_post = array();
  21. $current_post['post_loop_count']= $post_loop_count;
  22. $current_post['the_id'] = get_the_ID();
  23. $current_post['parity'] = $post_loop_count % 2 ? 'odd' : 'even';
  24. $current_post['last'] = count($wp_query->posts) == $post_loop_count ? " post-entry-last " : "";
  25. $current_post['post_type'] = get_post_type($current_post['the_id']);
  26. $current_post['post_class'] = "post-entry-".$current_post['the_id']." post-loop-".$post_loop_count." post-parity-".$current_post['parity'].$current_post['last']." ".$blog_style;
  27. $current_post['post_class'] .= ($current_post['post_type'] == "post") ? '' : ' post';
  28. $current_post['post_format'] = get_post_format() ? get_post_format() : 'standard';
  29. $current_post['post_layout'] = avia_layout_class('main', false);
  30.  
  31. /*
  32. * retrieve slider, title and content for this post,...
  33. */
  34. $size = strpos($blog_style, 'big') ? (strpos($current_post['post_layout'], 'sidebar') !== false) ? 'entry_with_sidebar' : 'entry_without_sidebar' : 'square';
  35.  
  36. if(!empty($avia_config['preview_mode']) && !empty($avia_config['image_size']) && $avia_config['preview_mode'] == 'custom') $size = $avia_config['image_size'];
  37. $current_post['slider'] = get_the_post_thumbnail($current_post['the_id'], $size);
  38.  
  39. if(is_single($initial_id) && get_post_meta( $current_post['the_id'], '_avia_hide_featured_image', true ) ) $current_post['slider'] = "";
  40.  
  41.  
  42. $current_post['title'] = get_the_title();
  43. $current_post['content'] = $blog_content == "content" ? get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow"> &rarr;</span>') : get_the_excerpt();
  44. $current_post['content'] = $blog_content == "excerpt_read_more" ? $current_post['content'].'<div class="read-more-link"><a href="'.get_permalink().'" class="more-link">'.__('Read more','avia_framework').'<span class="more-link-arrow"> &rarr;</span></a></div>' : $current_post['content'];
  45. $current_post['before_content'] = "";
  46.  
  47. /*
  48. * ...now apply a filter, based on the post type... (filter function is located in includes/helper-post-format.php)
  49. */
  50. $current_post = apply_filters( 'post-format-'.$current_post['post_format'], $current_post );
  51. $with_slider = empty($current_post['slider']) ? "" : "with-slider";
  52. /*
  53. * ... last apply the default wordpress filters to the content
  54. */
  55. $current_post['content'] = str_replace(']]>', ']]&gt;', apply_filters('the_content', $current_post['content'] ));
  56.  
  57. /*
  58. * Now extract the variables so that $current_post['slider'] becomes $slider, $current_post['title'] becomes $title, etc
  59. */
  60. extract($current_post);
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69. /*
  70. * render the html:
  71. */
  72.  
  73. echo "<article class='".implode(" ", get_post_class('post-entry post-entry-type-'.$post_format . " " . $post_class . " ".$with_slider))."' ".avia_markup_helper(array('context' => 'entry','echo'=>false)).">";
  74.  
  75. //default link for preview images
  76. $link = !empty($url) ? $url : get_permalink();
  77.  
  78. //preview image description
  79. $desc = get_post( get_post_thumbnail_id() ) -> post_excerpt;
  80. $featured_img_desc = ( $desc != null ) ? $desc : the_title_attribute( 'echo=0' );
  81.  
  82. //on single page replace the link with a fullscreen image
  83. if(is_singular())
  84. {
  85. $link = avia_image_by_id(get_post_thumbnail_id(), 'large', 'url');
  86. }
  87.  
  88.  
  89. //echo preview image
  90. if(strpos($blog_style, 'big') !== false)
  91. {
  92. if($slider) $slider = '<a href="'.$link.'" title="'.$featured_img_desc.'">'.$slider.'</a>';
  93. if($slider) echo '<div class="big-preview '.$blog_style.'">'.$slider.'</div>';
  94. }
  95.  
  96. if(!empty($before_content))
  97. echo '<div class="big-preview '.$blog_style.'">'.$before_content.'</div>';
  98.  
  99. echo "<div class='blog-meta'>";
  100.  
  101. $blog_meta_output = "";
  102. $icon = '<span class="iconfont" '.av_icon_string($post_format).'></span>';
  103.  
  104. if(strpos($blog_style, 'multi') !== false)
  105. {
  106. $gravatar = "";
  107. $link = get_post_format_link($post_format);
  108. if($post_format == 'standard')
  109. {
  110. $author_name = apply_filters('avf_author_name', get_the_author_meta('display_name', $post->post_author), $post->post_author);
  111. $author_email = apply_filters('avf_author_email', get_the_author_meta('email', $post->post_author), $post->post_author);
  112.  
  113. $gravatar_alt = esc_html($author_name);
  114. $gravatar = get_avatar($author_email, '81', "blank", $gravatar_alt);
  115. $link = get_author_posts_url($post->post_author);
  116. }
  117.  
  118. $blog_meta_output = "<a href='{$link}' class='post-author-format-type'><span class='rounded-container'>".$gravatar.$icon."</span></a>";
  119. }
  120. else if(strpos($blog_style, 'small') !== false)
  121. {
  122. $blog_meta_output = "<a href='{$link}' class='small-preview' title='{$featured_img_desc}'>".$slider.$icon."</a>";
  123. }
  124.  
  125. echo apply_filters('avf_loop_index_blog_meta', $blog_meta_output);
  126.  
  127. echo "</div>";
  128.  
  129. echo "<div class='entry-content-wrapper clearfix {$post_format}-content'>";
  130. echo '<header class="entry-content-header">';
  131. echo $title;
  132.  
  133. echo "<span class='post-meta-infos'>";
  134. $markup = avia_markup_helper(array('context' => 'entry_time','echo'=>false));
  135. echo "<time class='date-container minor-meta updated' $markup>".get_the_time(get_option('date_format'))."</time>";
  136. echo "<span class='text-sep text-sep-date'>/</span>";
  137.  
  138.  
  139.  
  140. if ( get_comments_number() != "0" || comments_open() ){
  141.  
  142. echo "<span class='comment-container minor-meta'>";
  143. comments_popup_link( "0 ".__('Comments','avia_framework'),
  144. "1 ".__('Comment' ,'avia_framework'),
  145. "% ".__('Comments','avia_framework'),'comments-link',
  146. "".__('Comments Disabled','avia_framework'));
  147. echo "</span>";
  148. echo "<span class='text-sep text-sep-comment'>/</span>";
  149. }
  150.  
  151.  
  152. $taxonomies = get_object_taxonomies(get_post_type($the_id));
  153. $cats = '';
  154. $excluded_taxonomies = apply_filters('avf_exclude_taxonomies', array('post_tag','post_format'), get_post_type($the_id), $the_id);
  155.  
  156. if(!empty($taxonomies))
  157. {
  158. foreach($taxonomies as $taxonomy)
  159. {
  160. if(!in_array($taxonomy, $excluded_taxonomies))
  161. {
  162. $cats .= get_the_term_list($the_id, $taxonomy, '', ', ','').' ';
  163. }
  164. }
  165. }
  166.  
  167. if(!empty($cats))
  168. {
  169. echo '<span class="blog-categories minor-meta">'.__('in','avia_framework')." ";
  170. echo $cats;
  171. echo '</span><span class="text-sep text-sep-cat">/</span>';
  172. }
  173.  
  174.  
  175. echo '<span class="blog-author minor-meta">'.__('by','avia_framework')." ";
  176. echo '<span class="entry-author-link" '.avia_markup_helper(array('context' => 'author_name','echo'=>false)).'>';
  177. echo '<span class="vcard author"><span class="fn">';
  178. the_author_posts_link();
  179. echo '</span></span>';
  180. echo '</span>';
  181. echo '</span>';
  182. echo '</span>';
  183. echo '</header>';
  184.  
  185. //share links on single post
  186. if(is_single()) avia_social_share_links();
  187.  
  188. // echo the post content
  189. echo '<div class="entry-content" '.avia_markup_helper(array('context' => 'entry_content','echo'=>false)).'>';
  190. echo $content;
  191. echo '</div>';
  192.  
  193. echo '<footer class="entry-footer">';
  194.  
  195. $avia_wp_link_pages_args = apply_filters('avf_wp_link_pages_args', array(
  196. 'before' =>'<nav class="pagination_split_post">'.__('Pages:','avia_framework'),
  197. 'after' =>'</nav>',
  198. 'pagelink' => '<span>%</span>',
  199. 'separator' => ' ',
  200. ));
  201.  
  202. wp_link_pages($avia_wp_link_pages_args);
  203.  
  204. if(is_single() && !post_password_required())
  205. {
  206. //tags on single post
  207. if(has_tag())
  208. {
  209. echo '<span class="blog-tags minor-meta">';
  210. the_tags('<strong>'.__('Tags:','avia_framework').'</strong><span> ');
  211. echo '</span></span>';
  212. }
  213. }
  214.  
  215. do_action('ava_after_content', $the_id, 'post');
  216.  
  217. echo '</footer>';
  218.  
  219. echo "<div class='post_delimiter'></div>";
  220. echo "</div>";
  221. echo "<div class='post_author_timeline'></div>";
  222. echo "</article>";
  223.  
  224. $post_loop_count++;
  225. endwhile;
  226. else:
  227.  
  228. ?>
  229.  
  230. <article class="entry">
  231. <header class="entry-content-header">
  232. <h1 class='post-title entry-title'><?php _e('Nothing Found', 'avia_framework'); ?></h1>
  233. </header>
  234.  
  235. <p class="entry-content" <?php avia_markup_helper(array('context' => 'entry_content')); ?>><?php _e('Sorry, no posts matched your criteria', 'avia_framework'); ?></p>
  236.  
  237. <footer class="entry-footer"></footer>
  238. </article>
  239.  
  240. <?php
  241.  
  242. endif;
  243.  
  244. if(empty($avia_config['remove_pagination'] ))
  245. {
  246. echo "<div class='{$blog_style}'>".avia_pagination('', 'nav')."</div>";
  247. }
  248. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement