Guest User

test

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