public function __construct($post_id) { $this->template_dir = AMP__DIR__ . '/templates'; $this->ID = $post_id; $this->post = get_post($post_id); $content_max_width = isset($GLOBALS['content_width']) ? absint($GLOBALS['content_width']) : 600; $content_max_width = apply_filters('amp_content_max_width', $content_max_width); $this->data = array('content_max_width' => $content_max_width, 'document_title' => function_exists('wp_get_document_title') ? wp_get_document_title() : wp_title('', false), 'canonical_url' => get_permalink($post_id), 'home_url' => home_url(), 'blog_name' => get_bloginfo('name'), 'site_icon_url' => get_site_icon_url(self::SITE_ICON_SIZE), 'placeholder_image_url' => amp_get_asset_url('images/placeholder-icon.png'), 'amp_runtime_script' => 'https://cdn.ampproject.org/v0.js', 'amp_component_scripts' => array()); $this->build_post_content(); $this->build_post_data(); $this->data = apply_filters('amp_post_template_data', $this->data, $this->post); }
public function __construct($post_id) { $this->template_dir = apply_filters('amp_post_template_dir', AMP__DIR__ . '/templates'); $this->ID = $post_id; $this->post = get_post($post_id); $content_max_width = self::CONTENT_MAX_WIDTH; if (isset($GLOBALS['content_width']) && $GLOBALS['content_width'] > 0) { $content_max_width = $GLOBALS['content_width']; } $content_max_width = apply_filters('amp_content_max_width', $content_max_width); $this->data = array('content_max_width' => $content_max_width, 'document_title' => function_exists('wp_get_document_title') ? wp_get_document_title() : wp_title('', false), 'canonical_url' => get_permalink($post_id), 'home_url' => home_url(), 'blog_name' => get_bloginfo('name'), 'body_class' => '', 'site_icon_url' => apply_filters('amp_site_icon_url', function_exists('get_site_icon_url') ? get_site_icon_url(self::SITE_ICON_SIZE) : ''), 'placeholder_image_url' => amp_get_asset_url('images/placeholder-icon.png'), 'featured_image' => false, 'comments_link_url' => false, 'comments_link_text' => false, 'amp_runtime_script' => 'https://cdn.ampproject.org/v0.js', 'amp_component_scripts' => array(), 'customizer_settings' => array(), 'font_urls' => array('merriweather' => 'https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic'), 'amp_analytics' => apply_filters('amp_post_template_analytics', array(), $this->post)); $this->build_post_content(); $this->build_post_data(); $this->build_customizer_settings(); $this->data = apply_filters('amp_post_template_data', $this->data, $this->post); }
color: #4f748e; background: #e9eff3; } blockquote p:last-child { margin-bottom: 0; } /* Other Elements */ amp-carousel { background: #000; } .amp-wp-iframe-placeholder { background: #f3f6f8 url( <?php echo esc_url(amp_get_asset_url('images/placeholder-icon.png')); ?> ) no-repeat center center; background-size: 48px 48px; min-height: 48px; } </style> </head> <body> <nav class="title-bar"> <div> <a href="<?php echo esc_url(home_url()); ?> "> <svg x="0px" y="0px" width="24" height="24" viewBox="0 0 24 24">
public static function enqueue_customizer_preview_scripts() { wp_enqueue_script('amp-customizer-design-preview', amp_get_asset_url('js/amp-customizer-design-preview.js'), array('amp-customizer'), false, true); wp_localize_script('amp-customizer-design-preview', 'amp_customizer_design', array('color_schemes' => self::get_color_schemes())); }
/** * Enqueues scripts and fires the 'wp_footer' action so we can output customizer scripts. * * This breaks AMP validation in the customizer but is necessary for the live preview. * * @since 0.4 * @access public */ public function add_preview_scripts() { wp_enqueue_script('amp-customizer', amp_get_asset_url('js/amp-customizer-preview.js'), array('jquery', 'customize-preview', 'wp-util'), $version = false, $footer = true); do_action('amp_customizer_enqueue_preview_scripts', $this->wp_customize); /** This action is documented in wp-includes/general-template.php */ do_action('wp_footer'); }