Created
April 30, 2014 12:06
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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