Guest User

Untitled

a guest
Jun 1st, 2022
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.16 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.  
  12.      $header_settings = avia_header_setting();
  13.      $no_title = $header_settings['header_title_bar'] == 'hidden_title_bar' || $header_settings['header_title_bar'] == 'breadcrumbs_only';
  14.  
  15.  
  16.      echo avia_title( array( 'title' => avia_which_archive() ) );
  17.  
  18.      do_action( 'ava_after_main_title' );
  19.     ?>
  20.  
  21.         <div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
  22.  
  23.             <div class='container template-blog '>
  24.  
  25.                 <main class='content <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper( array( 'context' => 'content' ) );?>>
  26.  
  27.                     <div class="category-term-description">
  28.                         <?php echo term_description(); ?>
  29.                     </div>
  30.  
  31.                     <?php
  32.                     global $wp_query, $posts;
  33.  
  34.                     $backup_query = $wp_query;
  35.  
  36.                     $sorted = array( 'post' => array() );
  37.                     $post_type_obj = array();
  38.  
  39.                     foreach( $posts as $post )
  40.                     {
  41.                         $sorted[ $post->post_type ][] = $post;
  42.                         if( empty( $post_type_obj[ $post->post_type] ) )
  43.                         {
  44.                             $post_type_obj[ $post->post_type ] = get_post_type_object( $post->post_type );
  45.                         }
  46.                     }
  47.  
  48.                     $avia_config['blog_style'] = apply_filters( 'avf_blog_style', avia_get_option( 'blog_style', 'multi-big' ), 'tag' );
  49.  
  50.                     $default_heading = 'h3';
  51.                     $args = array(
  52.                                 'heading'       => $default_heading,
  53.                                 'extra_class'   => ''
  54.                             );
  55.  
  56.                     /**
  57.                      * @since 4.5.5
  58.                      * @return array
  59.                      */
  60.                     $args = apply_filters( 'avf_customize_heading_settings', $args, 'tag', array() );
  61.  
  62.                     $heading = ! empty( $args['heading'] ) ? $args['heading'] : $default_heading;
  63.                     $css = ! empty( $args['extra_class'] ) ? $args['extra_class'] : '';
  64.  
  65.                     if( true )
  66.                     {
  67.                         $output = '';
  68.                         $post_ids = array();
  69.                         foreach( $posts as $post )
  70.                         {
  71.                             $post_ids[] = $post->ID;
  72.                         }
  73.  
  74.                         if( ! empty( $post_ids ) )
  75.                         {
  76.                             echo "<div class='entry-content-wrapper'>";
  77.  
  78.                             foreach( $sorted as $key => $post_type )
  79.                             {
  80.                                 if( empty( $post_type ) )
  81.                                 {
  82.                                     continue;
  83.                                 }
  84.  
  85.                                 if( isset( $post_type_obj[ $key ]->labels->name ) )
  86.                                 {
  87.                                     $label = $post_type_obj[ $key ]->labels->name;
  88.                                     if( $no_title )
  89.                                     {
  90.                                         $label = __( 'Tag Archive for:', 'avia_framework' ) . '  <span>' . single_tag_title( '', false ) . '</span>';
  91.                                     }
  92.  
  93.                                     /**
  94.                                      * @since ???
  95.                                      * @since 4.8.8         added $label, moved $post_type_obj[ $key ]->labels->name as second, $title
  96.                                      * @param string $label
  97.                                      * @param string $post_type_obj[ $key ]->labels->name
  98.                                      * @param string $title
  99.                                      * @return string
  100.                                      */
  101.                                     $label = apply_filters( 'avf_tag_label_names',$label, $post_type_obj[ $key ]->labels->name, $title );
  102.  
  103.                                     $output .= "<{$heading} class='post-title tag-page-post-type-title {$css}'>{$label}</{$heading}>";
  104.                                 }
  105.                                 else
  106.                                 {
  107.                                     $output .= '<hr />';
  108.                                 }
  109.  
  110.                                 $atts = array(
  111.                                             'type'          => 'bloglist-compact',
  112.                                             'items'         => get_option( 'posts_per_page' ),
  113.                                             'columns'       => 3,
  114.                                             'class'         => 'avia-builder-el-no-sibling',
  115.                                             'paginate'      => 'yes',
  116.                                             'use_main_query_pagination' => 'yes',
  117.                                             'custom_query'  => array(
  118.                                                                     'post__in'  => $post_ids,
  119.                                                                     'post_type' => $key
  120.                                                                 )
  121.                                         );
  122.  
  123.                                 /**
  124.                                  * @since 4.5.5
  125.                                  * @return array
  126.                                  */
  127.                                 $atts = apply_filters( 'avf_post_slider_args', $atts, 'tag' );
  128.  
  129.                                 $blog = new avia_post_slider( $atts );
  130.                                 $blog->query_entries();
  131.  
  132.                                 $output .= $blog->html();
  133.                             }
  134.  
  135.                             echo $output;
  136.                             echo '</div>';
  137.                         }
  138.                         else
  139.                         {
  140.                             get_template_part( 'includes/loop', 'index' );
  141.                         }
  142.                     }
  143.                     else
  144.                     {
  145.                         foreach( $sorted as $key => $post_type )
  146.                         {
  147.                             if( empty( $post_type ) )
  148.                             {
  149.                                 continue;
  150.                             }
  151.  
  152.                             if( isset( $post_type_obj[ $key ]->labels->name ) )
  153.                             {
  154.                                 $label = $post_type_obj[ $key ]->labels->name;
  155.                                 if( $no_title )
  156.                                 {
  157.                                     $label = __( 'Tag Archive for:', 'avia_framework' ) . '  <span>' . single_tag_title( '', false ) . '</span>';
  158.                                 }
  159.  
  160.                                 /**
  161.                                  * @since ???
  162.                                  * @since 4.8.8         added $label, moved $post_type_obj[ $key ]->labels->name as second, $title
  163.                                  * @param string $label
  164.                                  * @param string $post_type_obj[ $key ]->labels->name
  165.                                  * @param string $title
  166.                                  * @return string
  167.                                  */
  168.                                 $label = apply_filters( 'avf_tag_label_names', $label, $post_type_obj[ $key ]->labels->name, $title );
  169.  
  170.                                 echo "<{$heading} class='post-title tag-page-post-type-title {$css}'>{$label}</{$heading}>";
  171.                             }
  172.                             else
  173.                             {
  174.                                 echo "<hr />";
  175.                             }
  176.  
  177.                             if( $key == 'portfolio' )
  178.                             {
  179.                                 $args = array_merge( $wp_query->query_vars, array( 'post_type' => $key ) );
  180.                                 query_posts( $args );
  181.  
  182.                                 $grid = new avia_post_grid( array(
  183.                                                 'linking'           => '',
  184.                                                 'columns'           => '3',
  185.                                                 'contents'          => 'title',
  186.                                                 'sort'              => 'no',
  187.                                                 'paginate'          => 'yes',
  188.                                                 'set_breadcrumb'    => false,
  189.                                             ));
  190.  
  191.                                 $grid->use_global_query();
  192.                                 echo $grid->html( '' );
  193.                             }
  194.                             else
  195.                             {
  196.                                 $args = array_merge( $wp_query->query_vars, array( 'post_type' => $key ) );
  197.                                 query_posts( $args );
  198.  
  199.                                 $more = 0;
  200.                                 get_template_part( 'includes/loop', 'index' );
  201.                             }
  202.  
  203.                             $wp_query = $backup_query;
  204.                         }
  205.                     }
  206.                     ?>
  207.  
  208.                 <!--end content-->
  209.                 </main>
  210.  
  211.                 <?php
  212.  
  213.                 //get the sidebar
  214.                 $avia_config['currently_viewing'] = 'blog';
  215.                 get_sidebar();
  216.  
  217.                 ?>
  218.  
  219.             </div><!--end container-->
  220.  
  221.         </div><!-- close default .container_wrap element -->
  222.  
  223. <?php
  224.  
  225.         get_footer();
  226.  
  227.  
Advertisement
Add Comment
Please, Sign In to add comment