cipher87

Remove Author in Loop Index

Jul 1st, 2021
1,635
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 17.84 KB | None | 0 0
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {  exit;  }    // Exit if accessed directly
  3.  
  4.  
  5. global $avia_config, $post_loop_count;
  6.  
  7.  
  8. if( empty( $post_loop_count ) )
  9. {
  10.     $post_loop_count = 1;
  11. }
  12.  
  13. $blog_style = ! empty( $avia_config['blog_style'] ) ? $avia_config['blog_style'] : avia_get_option( 'blog_style', 'multi-big' );
  14. if( is_single() )
  15. {
  16.     $blog_style = avia_get_option( 'single_post_style', 'single-big' );
  17. }
  18.  
  19. $blog_global_style = avia_get_option( 'blog_global_style','' ); //alt: elegant-blog
  20.  
  21. $blog_disabled = ( avia_get_option('disable_blog') == 'disable_blog' ) ? true : false;
  22. if( $blog_disabled )
  23. {
  24.     if( current_user_can( 'edit_posts' ) )
  25.     {
  26.         $msg  = '<strong>' . __( 'Admin notice for:', 'avia_framework' ) . '</strong><br>';
  27.         $msg .= __( 'Blog Posts', 'avia_framework' ) . '<br><br>';
  28.         $msg .= __( 'This element was disabled in your theme settings. You can activate it here:', 'avia_framework' ) . '<br>';
  29.         $msg .= '<a target="_blank" href="' . admin_url( 'admin.php?page=avia#goto_performance') . '">' . __( 'Performance Settings', 'avia_framework' ) . '</a>';
  30.        
  31.         $content    = "<span class='av-shortcode-disabled-notice'>{$msg}</span>";
  32.        
  33.         echo $content;
  34.     }
  35.    
  36.      return;
  37. }
  38.  
  39.  
  40.  
  41.  
  42. $initial_id = avia_get_the_ID();
  43.  
  44. // check if we got posts to display:
  45. if( have_posts() ) :
  46.  
  47.     while( have_posts() ) : the_post();
  48.  
  49.        
  50.     /*
  51.      * get the current post id, the current post class and current post format
  52.      */
  53.     $url = '';
  54.     $current_post = array();
  55.     $current_post['post_loop_count'] = $post_loop_count;
  56.     $current_post['the_id'] = get_the_ID();
  57.     $current_post['parity'] = $post_loop_count % 2 ? 'odd' : 'even';
  58.     $current_post['last'] = count( $wp_query->posts ) == $post_loop_count ? ' post-entry-last ' : '';
  59.     $current_post['post_type'] = get_post_type( $current_post['the_id'] );
  60.     $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;
  61.     $current_post['post_class'] .= ( $current_post['post_type'] == 'post' ) ? '' : ' post';
  62.     $current_post['post_format'] = get_post_format() ? get_post_format() : 'standard';
  63.     $current_post['post_layout'] = avia_layout_class('main', false);
  64.     $blog_content = ! empty( $avia_config['blog_content'] ) ? $avia_config['blog_content'] : 'content';
  65.    
  66.     /*If post uses builder change content to exerpt on overview pages*/
  67.     if( Avia_Builder()->get_alb_builder_status( $current_post['the_id'] ) && ! is_singular( $current_post['the_id'] ) && $current_post['post_type'] == 'post' )
  68.     {
  69.        $current_post['post_format'] = 'standard';
  70.        $blog_content = 'excerpt_read_more';
  71.     }
  72.    
  73.     /**
  74.      * Allows especially for ALB posts to change output to 'content'
  75.      * Supported since 4.5.5
  76.      *
  77.      * @since 4.5.5
  78.      * @return string
  79.      */
  80.     $blog_content = apply_filters( 'avf_blog_content_in_loop', $blog_content, $current_post, $blog_style, $blog_global_style );
  81.    
  82.  
  83.     /*
  84.      * retrieve slider, title and content for this post,...
  85.      */
  86.     $size = strpos( $blog_style, 'big' ) ? ( ( strpos( $current_post['post_layout'], 'sidebar' ) !== false ) ? 'entry_with_sidebar' : 'entry_without_sidebar' ) : 'square';
  87.    
  88.     if( ! empty( $avia_config['preview_mode'] ) && ! empty( $avia_config['image_size'] ) && $avia_config['preview_mode'] == 'custom' )
  89.     {
  90.         $size = $avia_config['image_size'];
  91.     }
  92.    
  93.     /**
  94.      * @since 4.5.4
  95.      * @return string
  96.      */
  97.     $current_post['slider'] = apply_filters( 'avf_post_featured_image_link', get_the_post_thumbnail( $current_post['the_id'], $size ), $current_post, $size );
  98.    
  99.     /**
  100.      * Backwards comp. to checkbox prior v4.5.3 (now selectbox with '' or '1')
  101.      */
  102.     $hide_featured_image = empty( get_post_meta( $current_post['the_id'], '_avia_hide_featured_image', true ) ) ? false : true;
  103.     if( is_single( $initial_id ) && $hide_featured_image )
  104.     {
  105.         $current_post['slider'] = '';
  106.     }
  107.    
  108.     $current_post['title'] = get_the_title();
  109.    
  110.     /**
  111.      * Allow 3rd party to hook and return a plugin specific content.
  112.      * This returned content replaces Enfold's standard content building procedure.
  113.      *
  114.      * @since 4.5.7.2
  115.      * @param string
  116.      * @param string $context
  117.      * @return string
  118.      */
  119.     $current_post['content'] = apply_filters( 'avf_the_content', '', 'loop_index' );
  120.     if( '' == $current_post['content'] )
  121.     {
  122.         $current_post['content']    = $blog_content == 'content' ? get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow"></span>') : get_the_excerpt();
  123.         $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'];
  124.         $current_post['before_content'] = '';
  125.  
  126.         /*
  127.          * ...now apply a filter, based on the post type... (filter function is located in includes/helper-post-format.php)
  128.          */
  129.         $current_post = apply_filters( 'post-format-' . $current_post['post_format'], $current_post );
  130.         $with_slider = empty( $current_post['slider'] ) ? '' : 'with-slider';
  131.        
  132.         /*
  133.          * ... last apply the default wordpress filters to the content
  134.          */
  135.         $current_post['content'] = str_replace( ']]>', ']]&gt;', apply_filters( 'the_content', $current_post['content'] ) );
  136.     }
  137.  
  138.     /*
  139.      * Now extract the variables so that $current_post['slider'] becomes $slider, $current_post['title'] becomes $title, etc
  140.      */
  141.     extract( $current_post );
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.     /*
  151.      * render the html:
  152.      */
  153.  
  154.     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 ) ) . '>';
  155.        
  156.        
  157.        
  158.         //  default link for preview images
  159.         $link = ! empty( $url ) ? $url : get_permalink();
  160.        
  161.         //  prepare responsive lightbox images
  162.         $link_lightbox = false;
  163.         $lightbox_attr = '';
  164.        
  165.         //preview image description
  166.         $desc = '';
  167.         $thumb_post = get_post( get_post_thumbnail_id() );
  168.         if( $thumb_post instanceof WP_Post )
  169.         {
  170.             if( '' != trim( $thumb_post->post_excerpt ) )
  171.             {
  172.                 //  return 'Caption' from media gallery
  173.                 $desc = $thumb_post->post_excerpt;
  174.             }
  175.             else if( '' != trim( $thumb_post->post_title ) )
  176.             {
  177.                 //  return 'Title' from media gallery
  178.                 $desc = $thumb_post->post_title;
  179.             }
  180.             else if( '' != trim( $thumb_post->post_content ) )
  181.             {
  182.                 //  return 'Description' from media gallery
  183.                 $desc = $thumb_post->post_content;
  184.             }
  185.         }
  186.        
  187.         $desc = trim( $desc );
  188.         if( '' == $desc )
  189.         {
  190.             $desc = trim( the_title_attribute( 'echo=0' ) );
  191.         }
  192.        
  193.         /**
  194.          * Allows to change the title attribute text for the featured image.
  195.          * If '' is returned, then no title attribute is added.
  196.          *
  197.          * @since 4.6.4
  198.          * @param string $desc
  199.          * @param string $context               'loop_index'
  200.          * @param WP_Post $thumb_post
  201.          */
  202.         $featured_img_title = apply_filters( 'avf_featured_image_title_attr', $desc, 'loop_index', $thumb_post );
  203.        
  204.         $featured_img_title = '' != trim( $featured_img_title ) ? ' title="' . esc_attr( $featured_img_title ) . '" ' : '';
  205.  
  206.         //on single page replace the link with a fullscreen image
  207.         if( is_singular() )
  208.         {
  209.             if( ! $thumb_post instanceof WP_Post )
  210.             {
  211.                 $link = '';
  212.             }
  213.             else
  214.             {
  215.                 $link = avia_image_by_id( $thumb_post->ID, 'large', 'url' );
  216.  
  217.                 $lightbox_img = AviaHelper::get_url( 'lightbox', $thumb_post->ID, true );
  218.                 $lightbox_attr = Av_Responsive_Images()->html_attr_image_src( $lightbox_img, false );
  219.                 $link_lightbox = true;
  220.             }
  221.         }
  222.  
  223.         if( ! in_array( $blog_style, array( 'bloglist-simple', 'bloglist-compact', 'bloglist-excerpt' ) ) )
  224.         {
  225.             //echo preview image
  226.             if( strpos( $blog_global_style, 'elegant-blog' ) === false )
  227.             {
  228.                 if( strpos( $blog_style, 'big' ) !== false )
  229.                 {
  230.                     if( $slider )
  231.                     {
  232.                         if( $link_lightbox )
  233.                         {
  234.                             $slider = '<a ' . $lightbox_attr . ' ' . $featured_img_title . '>' . $slider . '</a>';
  235.                         }
  236.                         else
  237.                         {
  238.                             $slider = '<a href="' . $link . '" ' . $featured_img_title . '>' . $slider . '</a>';
  239.                         }
  240.                     }
  241.                    
  242.                     if( $slider )
  243.                     {
  244.                         echo '<div class="big-preview ' . $blog_style . '" ' . avia_markup_helper( array( 'context' => 'image', 'echo' => false ) ) . '>' . $slider . '</div>';
  245.                     }
  246.                 }
  247.  
  248.                 if( ! empty( $before_content ) )
  249.                 {
  250.                     echo '<div class="big-preview ' . $blog_style . '">' . $before_content . '</div>';
  251.                 }
  252.             }
  253.         }
  254.        
  255.         echo "<div class='blog-meta'>";
  256.  
  257.             $blog_meta_output = '';
  258.             $icon = '<span class="iconfont" ' . av_icon_string( $post_format ) . '></span>';
  259.  
  260.             if( strpos( $blog_style, 'multi' ) !== false )
  261.             {
  262.                 $gravatar = '';
  263.                 $pf_link = get_post_format_link( $post_format );
  264.  
  265.                 if( $post_format == 'standard' )
  266.                 {
  267.                     $author_name = apply_filters( 'avf_author_name', get_the_author_meta( 'display_name', $post->post_author ), $post->post_author );
  268.                     $author_email = apply_filters( 'avf_author_email', get_the_author_meta('email', $post->post_author), $post->post_author );
  269.  
  270.                     $gravatar_alt = esc_html( $author_name );
  271.                     $gravatar = get_avatar( $author_email, '81', 'blank', $gravatar_alt );
  272.                     $pf_link = get_author_posts_url( $post->post_author );
  273.                 }
  274.  
  275.                 $blog_meta_output = "<a href='{$pf_link}' class='post-author-format-type'><span class='rounded-container'>" . $gravatar . $icon . '</span></a>';
  276.             }
  277.             else if( strpos( $blog_style, 'small' ) !== false )
  278.             {
  279.                 if( $link_lightbox )
  280.                 {
  281.                     $attr = $lightbox_attr;
  282.                 }
  283.                 else
  284.                 {
  285.                     $attr = "href='{$link}'";
  286.                 }
  287.                 $blog_meta_output = "<a {$attr} class='small-preview' {$featured_img_title} " . avia_markup_helper( array( 'context' => 'image', 'echo' => false ) ). ">" . $slider . $icon . '</a>';
  288.             }
  289.  
  290.             echo apply_filters( 'avf_loop_index_blog_meta', $blog_meta_output );
  291.  
  292.         echo '</div>';
  293.  
  294.         echo "<div class='entry-content-wrapper clearfix {$post_format}-content'>";
  295.             echo '<header class="entry-content-header">';
  296.  
  297.                 if( $blog_style == 'bloglist-compact' )
  298.                 {
  299.                     $format = get_post_format();
  300.                     echo "<span class=' fallback-post-type-icon' " . av_icon_string($format) . '></span>';
  301.                 }
  302.  
  303.                 $close_header   = '</header>';
  304.                
  305.                 $content_output  = '<div class="entry-content" ' . avia_markup_helper( array( 'context' => 'entry_content', 'echo' => false ) ) . '>';
  306.                 $content_output .=      $content;
  307.                 $content_output .= '</div>';
  308.                
  309.                
  310.                 $taxonomies  = get_object_taxonomies( get_post_type( $the_id ) );
  311.                 $cats = '';
  312.                 $excluded_taxonomies = array_merge( get_taxonomies( array( 'public' => false ) ), array('post_tag','post_format') );
  313.                 $excluded_taxonomies = apply_filters( 'avf_exclude_taxonomies', $excluded_taxonomies, get_post_type( $the_id ), $the_id );
  314.  
  315.                 if( ! empty( $taxonomies ) )
  316.                 {
  317.                     foreach( $taxonomies as $taxonomy )
  318.                     {
  319.                         if( ! in_array( $taxonomy, $excluded_taxonomies ) )
  320.                         {
  321.                             $cats .= get_the_term_list( $the_id, $taxonomy, '', ', ', '' ) . ' ';
  322.                         }
  323.                     }
  324.                 }
  325.                
  326.                
  327.                
  328.                 //elegant blog
  329.                 //prev: if( $blog_global_style == 'elegant-blog' )
  330.                 if( strpos( $blog_global_style, 'elegant-blog' ) !== false )
  331.                 {
  332.                     $cat_output = '';
  333.  
  334.                     if( ! empty( $cats ) )
  335.                     {
  336.                         $cat_output .= '<span class="blog-categories minor-meta">';
  337.                         $cat_output .= $cats;
  338.                         $cat_output .= '</span>';
  339.                         $cats = '';
  340.                     }
  341.  
  342.                     if ( in_array( $blog_style, array( 'bloglist-compact', 'bloglist-excerpt' ) ) )
  343.                     {
  344.                         echo $title;
  345.                     }
  346.                     else
  347.                     {
  348.  
  349.                         // The wrapper div prevents the Safari reader from displaying the content twice  ¯\_(ツ)_/¯
  350.                         echo '<div class="av-heading-wrapper">';
  351.  
  352.                         if( strpos( $blog_global_style, 'modern-blog' ) === false )
  353.                         {
  354.                             echo $cat_output . $title;
  355.                         }
  356.                         else
  357.                         {
  358.                             echo $title . $cat_output;
  359.                         }
  360.  
  361.                         echo '</div>';
  362.                     }
  363.  
  364.                     echo $close_header;
  365.                     $close_header = '';
  366.  
  367.                     if( ! in_array( $blog_style, array( 'bloglist-simple', 'bloglist-compact', 'bloglist-excerpt' ) ) )
  368.                     {
  369.  
  370.                         echo '<span class="av-vertical-delimiter"></span>';
  371.  
  372.                         //echo preview image
  373.                         if( strpos( $blog_style, 'big' ) !== false )
  374.                         {
  375.                             if( $slider )
  376.                             {
  377.                                 if( $link_lightbox )
  378.                                 {
  379.                                     $slider = '<a ' . $lightbox_attr . ' ' . $featured_img_title . '>' . $slider . '</a>';
  380.                                 }
  381.                                 else
  382.                                 {
  383.                                     $slider = '<a href="' . $link . '" ' . $featured_img_title . '>' . $slider . '</a>';
  384.                                 }
  385.                             }
  386.  
  387.                             if( $slider )
  388.                             {
  389.                                 echo '<div class="big-preview ' . $blog_style . '" ' . avia_markup_helper( array( 'context' => 'image', 'echo' => false ) ) . '>' . $slider . '</div>';
  390.                             }
  391.                         }
  392.  
  393.  
  394.                         if( ! empty( $before_content ) )
  395.                         {
  396.                             echo '<div class="big-preview ' . $blog_style . '">' . $before_content . '</div>';
  397.                         }
  398.  
  399.                         echo $content_output;
  400.                     }
  401.                    
  402.                     $cats = '';
  403.                     $title = '';
  404.                     $content_output = '';
  405.                 }
  406.                
  407.                
  408.                 echo $title;
  409.  
  410.                 if( $blog_style !== 'bloglist-compact' )
  411.                 {
  412.                     echo "<span class='post-meta-infos'>";
  413.  
  414.                     echo "<time class='date-container minor-meta updated' >" . get_the_time( get_option( 'date_format' ) ) . '</time>';
  415.                     echo "<span class='text-sep text-sep-date'>/</span>";
  416.  
  417.                     if ( get_comments_number() != '0' || comments_open() )
  418.                     {
  419.  
  420.                         echo "<span class='comment-container minor-meta'>";
  421.                         comments_popup_link(  '0 ' . __( 'Comments', 'avia_framework' ),
  422.                                               '1 ' . __( 'Comment', 'avia_framework' ),
  423.                                               '% ' . __( 'Comments', 'avia_framework' ),
  424.                                               'comments-link',
  425.                                               '' . __( 'Comments Disabled','avia_framework' )
  426.                                 );
  427.                         echo '</span>';
  428.                     }
  429.  
  430.  
  431.                     if( ! empty( $cats ) )
  432.                     {
  433.                         echo '<span class="blog-categories minor-meta">' . __( 'in','avia_framework' ) . ' ';
  434.                         echo    $cats;
  435.                         echo '</span><span class="text-sep text-sep-cat">/</span>';
  436.                     }
  437.  
  438.                     if( $blog_style == 'bloglist-simple' )
  439.                     {
  440.                         echo '<div class="read-more-link"><a href="' . get_permalink() . '" class="more-link">' . __( 'Read more', 'avia_framework' ) . '<span class="more-link-arrow"></span></a></div>';
  441.                     }
  442.  
  443.                     echo '</span>';
  444.  
  445.                 } // display meta-infos on all layouts except bloglist-compact
  446.  
  447.             echo $close_header;
  448.  
  449.  
  450.             // echo the post content
  451.             if ( $blog_style == 'bloglist-excerpt')
  452.             {
  453.                 the_excerpt();
  454.                 echo '<div class="read-more-link"><a href="' . get_permalink() . '" class="more-link">' . __( 'Read more', 'avia_framework' ) . '<span class="more-link-arrow"></span></a></div>';
  455.             }
  456.  
  457.             if ( ! in_array( $blog_style, array( 'bloglist-simple', 'bloglist-compact', 'bloglist-excerpt' ) ) )
  458.             {
  459.                 echo $content_output;
  460.             }
  461.  
  462.  
  463.             echo '<footer class="entry-footer">';
  464.  
  465.             $avia_wp_link_pages_args = apply_filters( 'avf_wp_link_pages_args', array(
  466.                                                                         'before'    => '<nav class="pagination_split_post">' . __( 'Pages:', 'avia_framework' ),
  467.                                                                         'after'     => '</nav>',
  468.                                                                         'pagelink'  => '<span>%</span>',
  469.                                                                         'separator' => ' ',
  470.                                                                     ) );
  471.  
  472.             wp_link_pages( $avia_wp_link_pages_args );
  473.  
  474.             if( is_single() && ! post_password_required() )
  475.             {
  476.                 //tags on single post
  477.                 if( has_tag() )
  478.                 {
  479.                     echo '<span class="blog-tags minor-meta">';
  480.                         the_tags( '<strong>' . __( 'Tags:', 'avia_framework' ) . '</strong><span> ' );
  481.                     echo '</span></span>';
  482.                 }
  483.  
  484.                 //share links on single post
  485.                 avia_social_share_links_single_post();
  486.             }
  487.  
  488.             do_action( 'ava_after_content', $the_id, 'post' );
  489.  
  490.             echo '</footer>';
  491.  
  492.             echo "<div class='post_delimiter'></div>";
  493.         echo '</div>';
  494.         echo "<div class='post_author_timeline'></div>";
  495.         echo av_blog_entry_markup_helper( $current_post['the_id'] );
  496.        
  497.     echo '</article>';
  498.  
  499.     $post_loop_count++;
  500.     endwhile;
  501.     else:
  502.  
  503.             $default_heading = 'h1';
  504.             $args = array(
  505.                         'heading'       => $default_heading,
  506.                         'extra_class'   => ''
  507.                     );
  508.            
  509.             /**
  510.              * @since 4.5.5
  511.              * @return array
  512.              */
  513.             $args = apply_filters( 'avf_customize_heading_settings', $args, 'loop_index::nothing_found', array() );
  514.            
  515.             $heading = ! empty( $args['heading'] ) ? $args['heading'] : $default_heading;
  516.             $css = ! empty( $args['extra_class'] ) ? $args['extra_class'] : '';
  517. ?>
  518.  
  519.     <article class="entry">
  520.         <header class="entry-content-header">
  521.             <?php echo "<{$heading} class='post-title entry-title {$css}'>" . __( 'Nothing Found', 'avia_framework' ) . "</{$heading}>"; ?>
  522.         </header>
  523.  
  524.         <p class="entry-content" <?php avia_markup_helper( array( 'context' => 'entry_content' ) ); ?>><?php _e( 'Sorry, no posts matched your criteria', 'avia_framework' ); ?></p>
  525.  
  526.         <footer class="entry-footer"></footer>
  527.     </article>
  528.  
  529. <?php
  530.  
  531.     endif;
  532.  
  533.     if( empty( $avia_config['remove_pagination'] ) )
  534.     {
  535.         echo "<div class='{$blog_style}'>" . avia_pagination( '', 'nav' ) . '</div>';
  536.     }
  537.  
  538.  
Advertisement
Add Comment
Please, Sign In to add comment