I feel like I'm missing something here. So I'm using visual composer masonry grid to show posts. I'm trying to create a shortcode to use in the Visual composer grid builder that shows the date timestamp but even though the shortcode is being used in a loop I can't get the post id or things like the_title or the_date in the shortcode. I can even use other shortcodes within this one to pull in the title and other meta info and it shows post specific info.
This is my attempt... it outputs nothing, no errors at least, but no result...
function lmi_features_time_ago_shortcode( $atts, $post ) {
global $post;
$output = '';
$timestamp = get_the_date('Y-m-d g:i:s', $post->id);
// $timestamp = time_elapsed_string($timestamp);
$output .= $timestamp;
return $output;
}
add_shortcode( 'social_feed_ago', 'lmi_features_time_ago_shortcode' );