Make sure we have a post before using it to set class variables with.

This commit is contained in:
Greg 2023-01-16 10:26:38 -05:00
parent bf6cf24b17
commit caea1ecbed

View file

@ -17,6 +17,7 @@ class Post {
private $object_type;
public function __construct( $post = null ) {
if( $post ) {
$this->post = \get_post( $post );
$this->post_author = $this->post->post_author;
@ -26,6 +27,7 @@ class Post {
$this->attachments = $this->generate_attachments();
$this->tags = $this->generate_tags();
$this->object_type = $this->generate_object_type();
}
$shortcodes = array( 'ap_title', 'ap_excerpt', 'ap_content', 'ap_permalink', 'ap_shortlink', 'ap_hashtags', 'ap_thumbnail', 'ap_image', 'ap_hashcats', 'ap_author', 'ap_authorurl', 'ap_blogurl', 'ap_blogname', 'ap_blogdesc', 'ap_date', 'ap_time', 'ap_datetime' );