123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435 |
- <?php
- if ( !defined('ABSPATH') ){ die(); }
-
- global $avia_config, $more;
- /*
- * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
- */
- get_header();
-
-
- $showheader = true;
- if(avia_get_option('frontpage') && $blogpage_id = avia_get_option('blogpage'))
- {
- if(get_post_meta($blogpage_id, 'header', true) == 'no') $showheader = false;
- }
-
- if($showheader)
- {
- echo avia_title(array('title' => avia_which_archive()));
- }
-
- do_action( 'ava_after_main_title' );
- ?>
- <div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
- <div class='container template-blog '>
- <main class='content av-content-full alpha units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'post'));?>>
-
- <?php
-
- $tds = term_description();
- if($tds)
- {
- echo "<div class='category-term-description'>{$tds}</div>";
- }
- ?>
-
- <?php
- $avia_config['blog_style'] = apply_filters('avf_blog_style', avia_get_option('blog_style','multi-big'), 'archive');
- if($avia_config['blog_style'] == 'blog-grid')
- {
- global $posts;
- $post_ids = array();
- foreach($posts as $post) $post_ids[] = $post->ID;
- if(!empty($post_ids))
- {
- $atts = array(
- 'type' => 'grid',
- 'items' => get_option('posts_per_page'),
- 'columns' => 3,
- 'preview_mode' => 'custom',
- 'image_size' => 'full',
- 'class' => 'avia-builder-el-no-sibling',
- 'paginate' => 'yes',
- 'use_main_query_pagination' => 'yes',
- 'custom_query' => array( 'post__in'=>$post_ids, 'post_type'=>get_post_types() )
- );
- $blog = new avia_post_slider($atts);
- $blog->query_entries();
- echo "<div class='entry-content-wrapper'>".$blog->html()."</div>";
- }
- else
- {
- get_template_part( 'includes/loop', 'index' );
- }
- }
- else
- {
- /* Run the loop to output the posts.
- * If you want to overload this in a child theme then include a file
- * called loop-index.php and that will be used instead.
- */
- $more = 0;
- //get_template_part( 'includes/loop', 'index' );
-
- global $post_loop_count;
- if(empty($post_loop_count)) $post_loop_count = 1;
- $blog_style = !empty($avia_config['blog_style']) ? $avia_config['blog_style'] : avia_get_option('blog_style','multi-big');
- if(is_single()) $blog_style = avia_get_option('single_post_style','single-big');
- $blog_global_style = avia_get_option('blog_global_style',''); //alt: elegant-blog
- $initial_id = avia_get_the_ID();
- // check if we got posts to display:
- if (have_posts()) :
- while (have_posts()) : the_post();
- /*
- * get the current post id, the current post class and current post format
- */
- $url = "";
- $current_post = array();
- $current_post['post_loop_count']= $post_loop_count;
- $current_post['the_id'] = get_the_ID();
- $current_post['parity'] = $post_loop_count % 2 ? 'odd' : 'even';
- $current_post['last'] = count($wp_query->posts) == $post_loop_count ? " post-entry-last " : "";
- $current_post['post_type'] = get_post_type($current_post['the_id']);
- $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;
- $current_post['post_class'] .= ($current_post['post_type'] == "post") ? '' : ' post';
- $current_post['post_format'] = get_post_format() ? get_post_format() : 'standard';
- $current_post['post_layout'] = avia_layout_class('main', false);
- $blog_content = !empty($avia_config['blog_content']) ? $avia_config['blog_content'] : "content";
-
-
-
- /*
- * retrieve slider, title and content for this post,...
- */
- $size = strpos($blog_style, 'big') ? (strpos($current_post['post_layout'], 'sidebar') !== false) ? 'entry_with_sidebar' : 'entry_without_sidebar' : 'square';
-
- if(!empty($avia_config['preview_mode']) && !empty($avia_config['image_size']) && $avia_config['preview_mode'] == 'custom') $size = $avia_config['image_size'];
- $current_post['slider'] = get_the_post_thumbnail($current_post['the_id'], 'full');
-
- if(is_single($initial_id) && get_post_meta( $current_post['the_id'], '_avia_hide_featured_image', true ) ) $current_post['slider'] = "";
-
-
- $current_post['title'] = get_the_title();
- $current_post['content'] = $blog_content == "content" ? get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow"> →</span>') : get_the_excerpt();
- $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'];
- $current_post['before_content'] = "";
- /*
- * ...now apply a filter, based on the post type... (filter function is located in includes/helper-post-format.php)
- */
- $current_post = apply_filters( 'post-format-'.$current_post['post_format'], $current_post );
- $with_slider = empty($current_post['slider']) ? "" : "with-slider";
- /*
- * ... last apply the default wordpress filters to the content
- */
-
-
- $current_post['content'] = str_replace(']]>', ']]>', apply_filters('the_content', $current_post['content'] ));
- $current_post['content'] = wp_trim_words( get_the_content(), 50, '...' );
- /*
- * Now extract the variables so that $current_post['slider'] becomes $slider, $current_post['title'] becomes $title, etc
- */
- extract($current_post);
- /*
- * render the html:
- */
- echo '<div class="flex_column av_one_half flex_column_div first avia-builder-el-3 el_after_av_hr el_before_av_one_half">';
- 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)).">";
-
-
-
- //default link for preview images
- $link = !empty($url) ? $url : get_permalink();
-
- //preview image description
- $desc = get_post( get_post_thumbnail_id() );
- if(is_object($desc)) $desc = $desc -> post_excerpt;
- $featured_img_desc = ( $desc != "" ) ? $desc : the_title_attribute( 'echo=0' );
- //on single page replace the link with a fullscreen image
- if(is_singular())
- {
- $link = avia_image_by_id(get_post_thumbnail_id(), 'large', 'url');
- }
- //echo preview image
- if($blog_global_style !== 'elegant-blog')
- {
- if(strpos($blog_style, 'big') !== false)
- {
- if($slider) $slider = '<a href="'.$link.'" title="'.$featured_img_desc.'">'.$slider.'</a>';
- if($slider) echo '<div class="big-preview '.$blog_style.'">'.$slider.'</div>';
- }
-
- if(!empty($before_content))
- echo '<div class="big-preview '.$blog_style.'">'.$before_content.'</div>';
- }
-
- echo "<div class='blog-meta'>";
- $blog_meta_output = "";
- $icon = '<span class="iconfont" '.av_icon_string($post_format).'></span>';
- if(strpos($blog_style, 'multi') !== false)
- {
- $gravatar = "";
- $link = get_post_format_link($post_format);
- if($post_format == 'standard')
- {
- $author_name = apply_filters('avf_author_name', get_the_author_meta('display_name', $post->post_author), $post->post_author);
- $author_email = apply_filters('avf_author_email', get_the_author_meta('email', $post->post_author), $post->post_author);
-
- $gravatar_alt = esc_html($author_name);
- $gravatar = get_avatar($author_email, '81', "blank", $gravatar_alt);
- $link = get_author_posts_url($post->post_author);
- }
- $blog_meta_output = "<a href='{$link}' class='post-author-format-type'><span class='rounded-container'>".$gravatar.$icon."</span></a>";
- }
- else if(strpos($blog_style, 'small') !== false)
- {
- $blog_meta_output = "<a href='{$link}' class='small-preview' title='{$featured_img_desc}'>".$slider.$icon."</a>";
- }
- echo apply_filters('avf_loop_index_blog_meta', $blog_meta_output);
- echo "</div>";
- echo "<div class='entry-content-wrapper clearfix {$post_format}-content'>";
- echo '<header class="entry-content-header">';
-
- $content_output = '<div class="entry-content" '.avia_markup_helper(array('context' => 'entry_content','echo'=>false)).'>';
- $content_output .= $content;
- $content_output .= '</div>';
-
-
- $taxonomies = get_object_taxonomies(get_post_type($the_id));
- $cats = '';
- $excluded_taxonomies = array_merge( get_taxonomies( array( 'public' => false ) ), array('post_tag','post_format') );
- $excluded_taxonomies = apply_filters('avf_exclude_taxonomies', $excluded_taxonomies, get_post_type($the_id), $the_id);
- if(!empty($taxonomies))
- {
- foreach($taxonomies as $taxonomy)
- {
- if(!in_array($taxonomy, $excluded_taxonomies))
- {
- $cats .= get_the_term_list($the_id, $taxonomy, '', ', ','').' ';
- }
- }
- }
-
-
-
- //elegant blog
- if( $blog_global_style == 'elegant-blog' )
- {
- if(!empty($cats))
- {
- echo '<span class="blog-categories minor-meta">';
- echo $cats;
- echo '</span>';
- $cats = "";
- }
-
- echo $title;
-
- echo '<span class="av-vertical-delimiter"></span>';
-
- //echo preview image
- if(strpos($blog_style, 'big') !== false)
- {
- if($slider) $slider = '<a href="'.$link.'" title="'.$featured_img_desc.'">'.$slider.'</a>';
- if($slider) echo '<div class="big-preview '.$blog_style.'">'.$slider.'</div>';
- }
-
- if(!empty($before_content))
- echo '<div class="big-preview '.$blog_style.'">'.$before_content.'</div>';
-
-
- echo $content_output;
-
- $cats = "";
- $title = "";
- $content_output = "";
- }
-
-
-
-
- echo $title;
-
- echo "<span class='post-meta-infos'>";
-
- //echo "<time class='date-container minor-meta updated' >".get_the_time(get_option('date_format'))."</time>";
- //echo "<span class='text-sep text-sep-date'> </span>";
- if ( get_comments_number() != "0" || comments_open() ){
- echo "<span class='comment-container minor-meta'>";
- comments_popup_link( "0 ".__('Comments','avia_framework'),
- "1 ".__('Comment' ,'avia_framework'),
- "% ".__('Comments','avia_framework'),'comments-link',
- "".__('Comments Disabled','avia_framework'));
- echo "</span>";
- echo "<span class='text-sep text-sep-comment'> </span>";
- }
- if(!empty($cats))
- {
- echo '<span class="blog-categories minor-meta list-view-meta">'.__('','avia_framework')." ";
-
-
-
- // Start Display the primary location number
- if ( $terms = get_the_terms( $post->ID, 'location' ) ) {
- foreach( $terms as $term ) {
- $term_link = get_term_link( $term );
- echo '<a href="' . esc_url( $term_link ) . '">' . $term->name . '</a><br />';
- echo '' . $cats . '<br />';
- //$office = get_term_meta( $term->term_id, 'address', true );
- //echo '' . $office . '<br />';
- $phone = get_term_meta( $term->term_id, 'phone', true );
- echo '' . $phone . '<br />';
- }
- }
- // End Display the primary location number
-
-
- echo '</span><span class="text-sep text-sep-cat"> </span>';
- }
-
-
- echo '<span class="blog-author minor-meta">'.__('by','avia_framework')." ";
- echo '<span class="entry-author-link" >';
- echo '<span class="vcard author"><span class="fn">';
- the_author_posts_link();
- echo '</span></span>';
- echo '</span>';
- echo '</span>';
- echo '</span>';
- echo '</header>';
- // echo the post content
- //echo $content_output;
- echo '<footer class="entry-footer">';
- $avia_wp_link_pages_args = apply_filters('avf_wp_link_pages_args', array(
- 'before' =>'<nav class="pagination_split_post">'.__('Pages:','avia_framework'),
- 'after' =>'</nav>',
- 'pagelink' => '<span>%</span>',
- 'separator' => ' ',
- ));
- wp_link_pages($avia_wp_link_pages_args);
- if(is_single() && !post_password_required())
- {
- //tags on single post
- if(has_tag())
- {
- echo '<span class="blog-tags minor-meta">';
- the_tags('<strong>'.__('Tags:','avia_framework').'</strong><span> ');
- echo '</span></span>';
- }
-
- //share links on single post
- avia_social_share_links();
-
- }
-
- do_action('ava_after_content', $the_id, 'post');
- echo '</footer>';
-
- echo "</div>";
- echo "<div class='post_author_timeline'></div>";
- echo av_blog_entry_markup_helper($current_post['the_id']);
- echo "</article>";
- echo "</div>";
- $post_loop_count++;
- endwhile;
- else:
- ?>
- <article class="entry">
- <header class="entry-content-header">
- <h1 class='post-title entry-title'><?php _e('Nothing Found', 'avia_framework'); ?></h1>
- </header>
- <p class="entry-content" <?php avia_markup_helper(array('context' => 'entry_content')); ?>><?php _e('Sorry, no posts matched your criteria', 'avia_framework'); ?></p>
- <footer class="entry-footer"></footer>
- </article>
- <?php
- endif;
- if(empty($avia_config['remove_pagination'] ))
- {
- echo "<div class='{$blog_style}'>".avia_pagination('', 'nav')."</div>";
- }
-
-
-
-
-
-
- }
- ?>
- <!--end content-->
- </main>
- <?php
- //get the sidebar
- $avia_config['currently_viewing'] = 'page';
- //get_sidebar();
- ?>
- </div><!--end container-->
- </div><!-- close default .container_wrap element -->
- <?php get_footer(); ?>
|