Advertisement
cipher87

Archives Template without Monthly Archive

Jun 26th, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.62 KB | None | 0 0
  1. <?php
  2.     /*
  3.     Template Name: Archives Child
  4.     */
  5.  
  6.     if ( !defined('ABSPATH') ){ die(); }
  7.     /*
  8.      * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
  9.      */
  10.  
  11.  
  12.      global $avia_config, $more;
  13.      get_header();
  14.      echo avia_title();
  15.      
  16.      do_action( 'ava_after_main_title' );
  17.      
  18.         $default_heading = 'h3';
  19.         $args = array(
  20.                     'heading'       => $default_heading,
  21.                     'extra_class'   => ''
  22.                 );
  23.  
  24.         /**
  25.          * @since 4.5.5
  26.          * @return array
  27.          */
  28.         $args = apply_filters( 'avf_customize_heading_settings', $args, 'template-archives', array() );
  29.  
  30.         $heading = ! empty( $args['heading'] ) ? $args['heading'] : $default_heading;
  31.         $css = ! empty( $args['extra_class'] ) ? $args['extra_class'] : '';
  32.      ?>
  33.  
  34.  
  35.  
  36.         <div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
  37.  
  38.             <div class='container'>
  39.  
  40.                 <main class='template-archives content <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content'));?>>
  41.  
  42.                     <div class="entry-content-wrapper entry-content clearfix">
  43.  
  44.                     <?php
  45.                     //display the actual post content
  46.                     the_post();
  47.                     the_content();
  48.  
  49.  
  50.                     /*
  51.                     * Display the latest 20 blog posts
  52.                     */
  53.  
  54.  
  55.                     query_posts(array('posts_per_page'=>20));
  56.  
  57.                     // check if we got posts to display:
  58.                    
  59.  
  60.                     echo '<div class="tabcontainer top_tab">'."\n";
  61.                     echo '<div data-fake-id="#tab-id-1" class="tab active_tab">'.__('Blog Posts','avia_framework').'</div>'."\n";
  62.                    
  63.                    
  64.                     echo '<div class="tab_content active_tab_content" >'."\n";
  65.                     echo '<div class="tab_inner_content">'."\n";
  66.  
  67.                      if (have_posts()) :
  68.                     echo "<{$heading} class='av-archive-latest-posts {$css}'>" . __('The 20 latest Blog Posts','avia_framework') . "</{$heading}>";
  69.                     echo "<ul>";
  70.                         while (have_posts()) : the_post();
  71.  
  72.                         echo "<li><a href='".get_permalink()."' rel='bookmark' title='". __('Permanent Link:','avia_framework')." ".the_title_attribute('echo=0')."'>".get_the_title()."</a></li>";
  73.  
  74.                         endwhile;
  75.                     echo "</ul>";
  76.                     else:
  77.                    
  78.                       echo "<{$heading} class='av-archive-no-posts {$css}'>" . __('No Blog Posts found','avia_framework') . "</{$heading}>";
  79.                    
  80.                     endif;
  81.  
  82.                     echo '</div>'."\n";
  83.                     echo '</div>'."\n";
  84.  
  85.  
  86.                     /*
  87.                     * Display the latest 20 portfolio posts
  88.                     */
  89.  
  90.  
  91.                     query_posts(array('posts_per_page'=>8, 'post_type'=>'portfolio'));
  92.  
  93.                     // check if we got posts to display:
  94.                     if (have_posts()) :
  95.  
  96.  
  97.  
  98.                     $columns = 4;
  99.                     $rel_class = "av_one_fourth ";
  100.                     $slidecount = 0;
  101.                     $postcount = ($columns * 1);
  102.                     $count = 1;
  103.                     $output = "";
  104.                     $first = "first";
  105.  
  106.                     $output .= "<div class ='latest-portfolio-archive'>";
  107.                     $output .=      "<{$heading} class='av-archive-latest-portfolio {$css}'>" . __('The 8 latest Portfolio Entries','avia_framework') . "</{$heading}>";
  108.                     $output .= "<div class=' autoslide_false'>";
  109.  
  110.                     while (have_posts()) : the_post();
  111.  
  112.  
  113.                         $slidecount ++;
  114.  
  115.                         if($count == 1)
  116.                         {
  117.                             $output .= "<div class='single_slide single_slide_nr_$slidecount'>";
  118.                         }
  119.  
  120.                         $image = get_the_post_thumbnail( get_the_ID(), 'portfolio_small' );
  121.  
  122.                         if(empty($image))
  123.                         $image = "<span class='related_posts_default_image'></span>";
  124.  
  125.  
  126.  
  127.                         $output .= "<div class='relThumb relThumb flex_column {$count} {$first} {$rel_class}'>\n";
  128.                         $output .= "<a href='".get_permalink()."' class='relThumWrap noLightbox'>\n";
  129.                         $output .= "<span class='related_image_wrap'>";
  130.                         $output .= $image;
  131.                         $output .= "</span>\n";
  132.                         $output .= "<span class='relThumbTitle'>\n";
  133.                         $output .= "<strong class='relThumbHeading'>".avia_backend_truncate(get_the_title(), 50)."</strong>\n";
  134.                         $output .= "</span>\n</a>";
  135.                         $output .= "</div><!-- end .relThumb -->\n";
  136.  
  137.                         $count++;
  138.                         $first = "";
  139.                         if($count == $columns+1)
  140.                         {
  141.                             $first = "first";
  142.                             $output .= "</div>";
  143.                             $count = 1;
  144.                         }
  145.  
  146.                     endwhile;
  147.  
  148.                     if($count != 1) $output .= "</div>";
  149.  
  150.                     $output .= "</div></div>";
  151.  
  152.  
  153.                     echo '<div data-fake-id="#tab-id-2" class="tab">'.__('Portfolio','avia_framework').'</div>'."\n";
  154.                     echo '<div class="tab_content" >'."\n";
  155.                     echo '<div class="tab_inner_content">'."\n";
  156.  
  157.                     echo $output;
  158.  
  159.  
  160.                     echo '</div>'."\n";
  161.                     echo '</div>'."\n";
  162.  
  163.                     endif;
  164.  
  165.  
  166.  
  167.  
  168.                     /*
  169.                     * Display pages, categories and month archives
  170.                     */
  171.  
  172.                     echo '<div data-fake-id="#tab-id-3" class="tab">'.__('Pages','avia_framework').'</div>'."\n";
  173.                     echo '<div class="tab_content" >'."\n";
  174.                     echo '<div class="tab_inner_content">'."\n";
  175.  
  176.                     echo "<div class='one_third first archive_list'>";
  177.                     echo    "<{$heading} class='av-archive-pages {$css}'>" . __('Available Pages','avia_framework') . "</{$heading}>";
  178.                     echo "<ul>";
  179.                     wp_list_pages('title_li=&depth=-1' );
  180.                     echo "</ul>";
  181.                     echo "</div>";
  182.  
  183.                     echo '</div>'."\n";
  184.                     echo '</div>'."\n";
  185.  
  186.                     echo '<div data-fake-id="#tab-id-4" class="tab">'.__('Categories','avia_framework').'</div>'."\n";
  187.                     echo '<div class="tab_content" >'."\n";
  188.                     echo '<div class="tab_inner_content">'."\n";
  189.  
  190.                     echo "<div class='one_third archive_list'>";
  191.                     echo    "<{$heading} class='av-archive-subjects {$css}'>" . __('Archives by Subject:','avia_framework') . "</{$heading}>";
  192.                     echo "<ul>";
  193.                     wp_list_categories('sort_column=name&optioncount=0&hierarchical=0&title_li=');
  194.                     echo "</ul>";
  195.                     echo "</div>";
  196.  
  197.                     echo '</div>'."\n";
  198.                     echo '</div>'."\n";
  199.  
  200.                     echo '</div>'."\n" //tabcontainer close;
  201.  
  202.  
  203.                      ?>
  204.  
  205.  
  206.                     </div>
  207.  
  208.                 <!--end content-->
  209.                 </main>
  210.  
  211.                 <?php
  212.                 wp_reset_query();
  213.                 //get the sidebar
  214.                 $avia_config['currently_viewing'] = 'page';
  215.                 get_sidebar();
  216.  
  217.                 ?>
  218.  
  219.             </div><!--end container-->
  220.  
  221.         </div><!-- close default .container_wrap element -->
  222.  
  223.  
  224.  
  225.  
  226. <?php
  227.         get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement