EduardET

post meta

Feb 7th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.15 KB | None | 0 0
  1. function et_pb_postinfo_meta( $postinfo, $date_format, $comment_zero, $comment_one, $comment_more ){
  2.     $postinfo_meta = '';
  3.  
  4.     if ( in_array( 'author', $postinfo ) )
  5.         $postinfo_meta .= ' ' . esc_html__( 'by', 'et_builder' ) . ' <span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>';
  6.  
  7.     if ( in_array( 'date', $postinfo ) ) {
  8.         if ( in_array( 'author', $postinfo ) ) $postinfo_meta .= ' | ';
  9.         $postinfo_meta .= '<span class="published">' . esc_html( get_the_time( wp_unslash( $date_format ) ) ) . '</span>';
  10.     }
  11.  
  12.     if ( in_array( 'categories', $postinfo ) ) {
  13.         $categories_list = get_the_category_list(', ');
  14.  
  15.         // do not output anything if no categories retrieved
  16.         if ( '' !== $categories_list ) {
  17.             if ( in_array( 'author', $postinfo ) || in_array( 'date', $postinfo ) ) $postinfo_meta .= ' | ';
  18.  
  19.             $postinfo_meta .= $categories_list;
  20.         }
  21.     }
  22.  
  23.     if ( in_array( 'comments', $postinfo ) ){
  24.         if ( in_array( 'author', $postinfo ) || in_array( 'date', $postinfo ) || in_array( 'categories', $postinfo ) ) $postinfo_meta .= ' | ';
  25.         $postinfo_meta .= et_pb_get_comments_popup_link( $comment_zero, $comment_one, $comment_more );
  26.     }
  27.  
  28.     return $postinfo_meta;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment