Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2013
551
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.32 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. //on single page replace the link with a fullscreen image
  68. if(is_singular())
  69. {
  70. $link = avia_image_by_id(get_post_thumbnail_id(), 'large', 'url');
  71. }
  72.  
  73.  
  74. echo '<div class="entry-content-header">';
  75. echo $title;
  76.  
  77. echo "<span class='post-meta-infos'>";
  78. $markup = avia_markup_helper(array('context' => 'entry_time','echo'=>false));
  79. echo "<time class='date-container minor-meta updated' $markup>".get_the_time(get_option('date_format'))."</time>";
  80. echo "<span class='text-sep text-sep-date'>/</span>";
  81.  
  82.  
  83.  
  84. if ( get_comments_number() != "0" || comments_open() ){
  85.  
  86. echo "<span class='comment-container minor-meta'>";
  87. comments_popup_link( "0 ".__('Comments','avia_framework'),
  88. "1 ".__('Comment' ,'avia_framework'),
  89. "% ".__('Comments','avia_framework'),'comments-link',
  90. "".__('Comments Disabled','avia_framework'));
  91. echo "</span>";
  92. echo "<span class='text-sep text-sep-comment'>/</span>";
  93. }
  94.  
  95.  
  96. $taxonomies = get_object_taxonomies(get_post_type($the_id));
  97. $cats = '';
  98. $excluded_taxonomies = apply_filters('avf_exclude_taxonomies', array('post_tag','post_format'), get_post_type($the_id), $the_id);
  99.  
  100. if(!empty($taxonomies))
  101. {
  102. foreach($taxonomies as $taxonomy)
  103. {
  104. if(!in_array($taxonomy, $excluded_taxonomies))
  105. {
  106. $cats .= get_the_term_list($the_id, $taxonomy, '', ', ','').' ';
  107. }
  108. }
  109. }
  110.  
  111. if(!empty($cats))
  112. {
  113. echo '<span class="blog-categories minor-meta">'.__('in','avia_framework')." ";
  114. echo $cats;
  115. echo '</span><span class="text-sep text-sep-cat">/</span>';
  116. }
  117.  
  118.  
  119. echo '<span class="blog-author minor-meta">'.__('by','avia_framework')." ";
  120. echo '<span class="entry-author-link" '.avia_markup_helper(array('context' => 'author_name','echo'=>false)).'>';
  121. echo '<span class="vcard author"><span class="fn">';
  122. the_author_posts_link();
  123. echo '</span></span>';
  124. echo '</span>';
  125. echo '</span>';
  126. echo '</span>';
  127. echo '</div>';
  128.  
  129.  
  130. //echo preview image
  131. if(strpos($blog_style, 'big') !== false)
  132. {
  133. if($slider) $slider = '<a href="'.$link.'">'.$slider.'</a>';
  134. if($slider) echo '<div class="big-preview '.$blog_style.'">'.$slider.'</div>';
  135. }
  136.  
  137. if(!empty($before_content))
  138. echo '<div class="big-preview '.$blog_style.'">'.$before_content.'</div>';
  139.  
  140. echo "<div class='blog-meta'>";
  141.  
  142. $blog_meta_output = "";
  143. $icon = '<span class="iconfont" '.av_icon_string($post_format).'></span>';
  144.  
  145. if(strpos($blog_style, 'multi') !== false)
  146. {
  147. $gravatar = "";
  148. $link = get_post_format_link($post_format);
  149. if($post_format == 'standard')
  150. {
  151. $gravatar = get_avatar( get_the_author_meta('email'), '81', "blank" );
  152. $link = get_author_posts_url($post->post_author);
  153. }
  154.  
  155. $blog_meta_output = "<a href='{$link}' class='post-author-format-type'><span class='rounded-container'>".$gravatar.$icon."</span></a>";
  156. }
  157. else if(strpos($blog_style, 'small') !== false)
  158. {
  159. $blog_meta_output = "<a href='{$link}' class='small-preview'>".$slider.$icon."</a>";
  160. }
  161.  
  162. echo apply_filters('avf_loop_index_blog_meta', $blog_meta_output);
  163.  
  164. echo "</div>";
  165.  
  166. echo "<div class='entry-content-wrapper clearfix {$post_format}-content'>";
  167.  
  168.  
  169.  
  170. // echo the post content
  171. echo '<div class="entry-content" '.avia_markup_helper(array('context' => 'entry_content','echo'=>false)).'>';
  172. echo $content;
  173. echo '</div>';
  174.  
  175. echo '<footer class="entry-footer">';
  176.  
  177. wp_link_pages(array('before' =>'<div class="pagination_split_post">',
  178. 'after' =>'</div>',
  179. 'pagelink' => '<span>%</span>'
  180. ));
  181.  
  182. if(has_tag() && is_single() && !post_password_required())
  183. {
  184. echo '<span class="blog-tags minor-meta">';
  185. the_tags('<strong>'.__('Tags:','avia_framework').'</strong><span> ');
  186. echo '</span></span>';
  187. }
  188.  
  189. echo '</footer>';
  190.  
  191. echo "<div class='post_delimiter'></div>";
  192. echo "</div>";
  193. echo "<div class='post_author_timeline'></div>";
  194. echo "</article>";
  195.  
  196. $post_loop_count++;
  197. endwhile;
  198. else:
  199.  
  200. ?>
  201.  
  202. <article class="entry">
  203. <header class="entry-content-header">
  204. <h1 class='post-title entry-title'><?php _e('Nothing Found', 'avia_framework'); ?></h1>
  205. </header>
  206.  
  207. <p class="entry-content" <?php avia_markup_helper(array('context' => 'entry_content')); ?>><?php _e('Sorry, no posts matched your criteria', 'avia_framework'); ?></p>
  208.  
  209. <footer class="entry-footer"></footer>
  210. </article>
  211.  
  212. <?php
  213.  
  214. endif;
  215.  
  216. if(empty($avia_config['remove_pagination'] ))
  217. {
  218. echo "<div class='{$blog_style}'>".avia_pagination('', 'nav')."</div>";
  219. }
  220. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement