Skip to content

Instantly share code, notes, and snippets.

@sunriseweb
Created April 30, 2014 12:06
Show Gist options
  • Save sunriseweb/f6b548fb7ae512762564 to your computer and use it in GitHub Desktop.
Save sunriseweb/f6b548fb7ae512762564 to your computer and use it in GitHub Desktop.
Remove trailing pipe from single post meta in Divi child theme by modifing et_postinfo_meta in functions.php
<?php
//* Modify post meta to get rid of trailing pipe
function et_postinfo_meta( $postinfo, $date_format, $comment_zero, $comment_one, $comment_more ){
global $themename;
$postinfo_meta = '';
if ( in_array( 'author', $postinfo ) )
$postinfo_meta .= ' ' . esc_html__('by',$themename) . ' ' . et_get_the_author_posts_link() . ' | ';
if ( in_array( 'date', $postinfo ) )
$postinfo_meta .= get_the_time( $date_format ) . ' | ';
if ( in_array( 'categories', $postinfo ) )
$postinfo_meta .= get_the_category_list(', ') . ' | ';
if ( in_array( 'comments', $postinfo ) )
$postinfo_meta .= et_get_comments_popup_link( $comment_zero, $comment_one, $comment_more );
$trailingpipecheck = substr($postinfo_meta, strlen($postinfo_meta)-3, strlen($postinfo_meta));
if ( $trailingpipecheck == ' | ' )
$postinfo_meta = substr($postinfo_meta, 0, strlen($postinfo_meta)-3);
echo $postinfo_meta;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment