Advertisement
cipher87

Tag

Feb 9th, 2021
541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.03 KB | None | 0 0
  1. <?php
  2.     if ( !defined('ABSPATH') ){ die(); }
  3.    
  4.     global $avia_config, $more;
  5.  
  6.     /*
  7.      * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
  8.      */
  9.      get_header();
  10.  
  11.      echo avia_title(array('title' => avia_which_archive()));
  12.      
  13.      do_action( 'ava_after_main_title' );
  14.     ?>
  15.  
  16.         <div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
  17.  
  18.             <div class='container template-blog '>
  19.  
  20.                 <main class='content <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content'));?>>
  21.  
  22.                     <div class="category-term-description">
  23.                         <?php echo term_description(); ?>
  24.                     </div>
  25.  
  26.                     <?php
  27.                     global $wp_query, $posts;
  28.                     $backup_query = $wp_query;
  29.  
  30.                     $sorted = array('post'=>array());
  31.                     $post_type_obj = array();
  32.  
  33.                     foreach($posts as $post)
  34.                     {
  35.                         $sorted[$post->post_type][] = $post;
  36.                         if(empty($post_type_obj[$post->post_type]))
  37.                         {
  38.                             $post_type_obj[$post->post_type] = get_post_type_object($post->post_type);
  39.                         }
  40.                     }
  41.  
  42.                     $avia_config['blog_style'] = apply_filters('avf_blog_style', avia_get_option('blog_style','multi-big'), 'tag');
  43.                    
  44.                     $default_heading = 'h3';
  45.                     $args = array(
  46.                                 'heading'       => $default_heading,
  47.                                 'extra_class'   => ''
  48.                             );
  49.  
  50.                     /**
  51.                      * @since 4.5.5
  52.                      * @return array
  53.                      */
  54.                     $args = apply_filters( 'avf_customize_heading_settings', $args, 'tag', array() );
  55.  
  56.                     $heading = ! empty( $args['heading'] ) ? $args['heading'] : $default_heading;
  57.                     $css = ! empty( $args['extra_class'] ) ? $args['extra_class'] : '';
  58.    
  59.                    
  60.                     if( $avia_config['blog_style'] == 'blog-grid' )
  61.                     {
  62.                         $output = '';
  63.                         $post_ids = array();
  64.                         foreach( $posts as $post )
  65.                         {
  66.                             $post_ids[] = $post->ID;
  67.                         }
  68.  
  69.                         if( ! empty( $post_ids ) )
  70.                         {
  71.                             echo "<div class='entry-content-wrapper'>";
  72.  
  73.                             foreach( $sorted as $key => $post_type )
  74.                             {
  75.                                 if( empty( $post_type ) )
  76.                                 {
  77.                                     continue;
  78.                                 }
  79.  
  80.                                 if( isset( $post_type_obj[ $key ]->labels->name ) )
  81.                                 {
  82.                                     $label = apply_filters( 'avf_tag_label_names', $post_type_obj[ $key ]->labels->name );
  83.                                     $output .= "<{$heading} class='post-title tag-page-post-type-title {$css}'>{$label}</{$heading}>";
  84.                                 }
  85.                                 else
  86.                                 {
  87.                                     $output .= '<hr />';
  88.                                 }
  89.  
  90.                                 $atts = array(
  91.                                             'type'          => 'grid',
  92.                                             'items'         => get_option( 'posts_per_page' ),
  93.                                             'columns'       => 3,
  94.                                             'class'         => 'avia-builder-el-no-sibling',
  95.                                             'paginate'      => 'yes',
  96.                                             'use_main_query_pagination' => 'yes',
  97.                                             'custom_query'  => array(
  98.                                                                     'post__in'  => $post_ids,
  99.                                                                     'post_type' => $key
  100.                                                                 )
  101.                                         );
  102.  
  103.                                 /**
  104.                                  * @since 4.5.5
  105.                                  * @return array
  106.                                  */
  107.                                 $atts = apply_filters( 'avf_post_slider_args', $atts, 'tag' );
  108.  
  109.                                 $blog = new avia_post_slider( $atts );
  110.                                 $blog->query_entries();
  111.                                
  112.                                 $output .= $blog->html();
  113.                             }
  114.  
  115.                             echo $output;
  116.                             echo '</div>';
  117.                         }
  118.                         else
  119.                         {
  120.                             get_template_part( 'includes/loop', 'index' );
  121.                         }
  122.                     }
  123.                     else
  124.                     {
  125.                         foreach( $sorted as $key => $post_type )
  126.                         {
  127.                             if(empty($post_type)) continue;
  128.                              
  129.                             if(isset($post_type_obj[$key]->labels->name))
  130.                             {
  131.                                 $label = apply_filters('avf_tag_label_names', $post_type_obj[$key]->labels->name);
  132.                                 echo "<{$heading} class='post-title tag-page-post-type-title {$css}'>{$label}</{$heading}>";
  133.                             }
  134.                             else
  135.                             {
  136.                                 echo "<hr />";
  137.                             }
  138.  
  139.                             if($key == 'portfolio')
  140.                             {
  141.                                 $args = array_merge( $wp_query->query_vars, array( 'post_type' => $key ) );
  142.                                 query_posts( $args );
  143.  
  144.                                 $grid = new avia_post_grid(array(   'linking'   => '',
  145.                                     'columns'   => '3',
  146.                                     'contents'  => 'title',
  147.                                     'sort'      => 'no',
  148.                                     'paginate'  => 'yes',
  149.                                     'set_breadcrumb' => false,
  150.                                 ));
  151.                                 $grid->use_global_query();
  152.                                 echo $grid->html();
  153.                             }
  154.                             else
  155.                             {
  156.                                 $args = array_merge( $wp_query->query_vars, array( 'post_type' => $key ) );
  157.                                 query_posts( $args );
  158.  
  159.                                 $more = 0;
  160.                                 get_template_part( 'includes/loop', 'index' );
  161.                             }
  162.  
  163.                             $wp_query = $backup_query;
  164.                         }
  165.                     }
  166.                     ?>
  167.  
  168.                 <!--end content-->
  169.                 </main>
  170.  
  171.                 <?php
  172.  
  173.                 //get the sidebar
  174.                 $avia_config['currently_viewing'] = 'blog';
  175.                 get_sidebar();
  176.  
  177.                 ?>
  178.  
  179.             </div><!--end container-->
  180.  
  181.         </div><!-- close default .container_wrap element -->
  182.  
  183.  
  184. <?php
  185.  
  186.         get_footer();
  187.        
  188.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement