Advertisement
Guest User

Untitled

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