Skip to content

Commit

Permalink
Slight code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
ThierryA committed Dec 7, 2017
1 parent 802bcfb commit 1b6cc54
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions includes/class-amp-post-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,11 @@ public function __construct( $post ) {
$this->template_dir = apply_filters( 'amp_post_template_dir', AMP__DIR__ . '/templates' );

if ( $post instanceof WP_Post ) {
$this->ID = $post->ID;
$this->post = $post;
} else {
$this->post = get_post( $post );
$this->ID = $this->post->ID;
}
$post_id = $this->ID;
$this->ID = $this->post->ID;

$content_max_width = self::CONTENT_MAX_WIDTH;
if ( isset( $GLOBALS['content_width'] ) && $GLOBALS['content_width'] > 0 ) {
Expand All @@ -135,7 +133,7 @@ public function __construct( $post ) {
'content_max_width' => $content_max_width,

'document_title' => function_exists( 'wp_get_document_title' ) ? wp_get_document_title() : wp_title( '', false ), // Back-compat with 4.3.
'canonical_url' => get_permalink( $post_id ),
'canonical_url' => get_permalink( $this->ID ),
'home_url' => home_url(),
'blog_name' => get_bloginfo( 'name' ),
'generator_metadata' => 'AMP Plugin v' . AMP__VERSION,
Expand Down

0 comments on commit 1b6cc54

Please sign in to comment.