im a beginner with PHP, so i hope that someone can help me solving this issue.
I want to display the expiration date of a post with the following plugin /
I've think i can use:
$hasp_expire_date = get_post_meta( $post_id, ‘hasp_expire_date’, true );
But i don't know how to insert it into a php file. I need to place in this code (Where it says CODE HERE):
$num_comments = get_comments_number( $block_data['id'] );
$entry_comments = 'CODE HERE<i class="fa fa-speech-bubble"></i><span>'.$num_comments.' '._nx( 'Comment', 'Comments', $num_comments, 'comments', 'uncode' ).'</span>';
im a beginner with PHP, so i hope that someone can help me solving this issue.
I want to display the expiration date of a post with the following plugin https://wordpress/plugins/advanced-schedule-posts/
I've think i can use:
$hasp_expire_date = get_post_meta( $post_id, ‘hasp_expire_date’, true );
But i don't know how to insert it into a php file. I need to place in this code (Where it says CODE HERE):
$num_comments = get_comments_number( $block_data['id'] );
$entry_comments = 'CODE HERE<i class="fa fa-speech-bubble"></i><span>'.$num_comments.' '._nx( 'Comment', 'Comments', $num_comments, 'comments', 'uncode' ).'</span>';
Share
Improve this question
asked Nov 5, 2019 at 11:55
JustifieldJustifield
1
1 Answer
Reset to default 0Assuming your $hasp_expire_date = get_post_meta( $post_id, ‘hasp_expire_date’, true );
is giving you the correct value you need, you are storing your that in the $hasp_expire_date
variable.
So edit that second line to:
$num_comments = get_comments_number( $block_data['id'] );
// Pull in the value you need
$hasp_expire_date = get_post_meta( $post_id, ‘hasp_expire_date’, true );
// You are going to concatenate or add that value to your string.
$entry_comments = $hasp_expire_date.'<i class="fa fa-speech-bubble"></i><span>'.$num_comments.' '._nx( 'Comment', 'Comments', $num_comments, 'comments', 'uncode' ).'</span>';
Hope that helps!!