Site icon Hip-Hop Website Design and Development

Examine if is Publish or Remark

I made a perform to show the time since posting an article or remark.

perform custom_posted_ago() {

    world $put up;
    world $remark;

    if ( get_post_type() ) :

        $object_ID = get_the_ID( $put up );

        $timeDiff = human_time_diff( get_the_time( 'U', $object_ID ), current_time( 'timestamp' ) );
        $theTime = '<span>' . $timeDiff . '</span>';

    else :

        $object_ID = get_comment_ID( $remark );

        $timeDiff = human_time_diff( get_comment_date( 'U', $object_ID ), current_time( 'timestamp' ) );
        $theTime = '<span>' . $timeDiff . '</span>';

    endif;

    $timeAgo  = sprintf( __( '%s in the past', 'o2' ), $theTime );

    return $timeAgo;

}

But when I place it in a remark, it sends me the info of the put up.

How can I accurately formulate my situation?