Advertisement
Guest User

Untitled

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