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.org/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>';

Assuming 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!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.