Make sure we have a post before using it to set class variables with.
This commit is contained in:
parent
bf6cf24b17
commit
caea1ecbed
1 changed files with 10 additions and 8 deletions
|
@ -17,15 +17,17 @@ class Post {
|
||||||
private $object_type;
|
private $object_type;
|
||||||
|
|
||||||
public function __construct( $post = null ) {
|
public function __construct( $post = null ) {
|
||||||
$this->post = \get_post( $post );
|
if( $post ) {
|
||||||
|
$this->post = \get_post( $post );
|
||||||
|
|
||||||
$this->post_author = $this->post->post_author;
|
$this->post_author = $this->post->post_author;
|
||||||
$this->id = $this->generate_id();
|
$this->id = $this->generate_id();
|
||||||
$this->summary = $this->generate_the_title();
|
$this->summary = $this->generate_the_title();
|
||||||
$this->content = $this->generate_the_content();
|
$this->content = $this->generate_the_content();
|
||||||
$this->attachments = $this->generate_attachments();
|
$this->attachments = $this->generate_attachments();
|
||||||
$this->tags = $this->generate_tags();
|
$this->tags = $this->generate_tags();
|
||||||
$this->object_type = $this->generate_object_type();
|
$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' );
|
$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' );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue