public function render($args) { $args = wp_parse_args($args, array('url' => false, 'instagram_id' => false)); if (empty($args['instagram_id'])) { return AMP_HTML_Utils::build_tag('a', array('href' => esc_url($args['url']), 'class' => 'amp-wp-embed-fallback'), esc_html($args['url'])); } $this->did_convert_elements = true; return AMP_HTML_Utils::build_tag('amp-instagram', array('data-shortcode' => $args['instagram_id'], 'layout' => 'responsive', 'width' => $this->args['width'], 'height' => $this->args['height'])); }
public function render($args) { $this->did_convert_elements = true; $args = wp_parse_args($args, array('video_id' => false)); if (empty($args['video_id'])) { return AMP_HTML_Utils::build_tag('a', array('href' => $args['url'], 'class' => 'amp-wp-fallback'), $args['url']); } return AMP_HTML_Utils::build_tag('amp-youtube', wp_parse_args(array('data-videoid' => $args['video_id'], 'layout' => 'responsive'), $this->args)); }
public function render($args) { $args = wp_parse_args($args, array('url' => false, 'vine_id' => false)); if (empty($args['vine_id'])) { return AMP_HTML_Utils::build_tag('a', array('href' => esc_url($args['url']), 'class' => 'amp-wp-embed-fallback'), esc_html($args['url'])); } $this->did_convert_elements = true; return AMP_HTML_Utils::build_tag('amp-vine', wp_parse_args(array('data-vineid' => $args['vine_id'], 'layout' => 'responsive'), $this->args)); }
public function render($args) { $args = wp_parse_args($args, array('url' => false)); if (empty($args['url'])) { return ''; } $this->did_convert_elements = true; return AMP_HTML_Utils::build_tag('amp-facebook', array('data-href' => $args['url'], 'layout' => 'responsive', 'width' => $this->args['width'], 'height' => $this->args['height'])); }
public function render($args) { $this->did_convert_elements = true; $args = wp_parse_args($args, array('images' => false)); if (empty($args['images'])) { return ''; } $images = array(); foreach ($args['images'] as $image) { $images[] = AMP_HTML_Utils::build_tag('amp-img', array('src' => $image['url'], 'width' => $image['width'], 'height' => $image['height'])); } return AMP_HTML_Utils::build_tag('amp-carousel', wp_parse_args(array(), $this->args), implode(PHP_EOL, $images)); }
function shortcode($attr) { $attr = wp_parse_args($attr, array('tweet' => false)); $id = false; if (intval($attr['tweet'])) { $id = intval($attr['tweet']); } else { preg_match(self::URL_PATTERN, $attr['tweet'], $matches); if (isset($matches[5]) && intval($matches[5])) { $id = intval($matches[5]); } if (empty($id)) { return ''; } } $this->did_convert_elements = true; return AMP_HTML_Utils::build_tag('amp-twitter', array_merge($this->args, array('data-tweetid' => $id, 'layout' => 'responsive'))); }
function shortcode($attr) { $attr = wp_parse_args($attr, array('tweet' => false)); if (empty($attr['tweet']) && !empty($attr[0])) { $attr['tweet'] = $attr[0]; } $id = false; if (is_numeric($attr['tweet'])) { $id = $attr['tweet']; } else { preg_match(self::URL_PATTERN, $attr['tweet'], $matches); if (isset($matches[5]) && is_numeric($matches[5])) { $id = $matches[5]; } if (empty($id)) { return ''; } } $this->did_convert_elements = true; return AMP_HTML_Utils::build_tag('amp-twitter', array('data-tweetid' => $id, 'layout' => 'responsive', 'width' => $this->args['width'], 'height' => $this->args['height'])); }
<?php global $redux_builder_amp; ?> <!doctype html> <html amp <?php echo AMP_HTML_Utils::build_attributes_string($this->get('html_tag_attributes')); ?> > <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"> <?php do_action('amp_post_template_head', $this); ?> <style amp-custom> <?php $this->load_parts(array('style')); ?> <?php do_action('amp_post_template_css', $this); ?> </style> </head> <body class="single-post <?php echo esc_attr($this->get('body_class')); ?> "> <?php
function amp_post_template_add_analytics_data($amp_template) { $analytics_entries = $amp_template->get('amp_analytics'); if (empty($analytics_entries)) { return; } foreach ($analytics_entries as $id => $analytics_entry) { if (!isset($analytics_entry['type'], $analytics_entry['attributes'], $analytics_entry['config_data'])) { _doing_it_wrong(__FUNCTION__, sprintf(__('Analytics entry for %s is missing one of the following keys: `type`, `attributes`, or `config_data` (array keys: %s)', 'amp'), esc_html($id), esc_html(implode(', ', array_keys($analytics_entry)))), '0.3.2'); continue; } $script_element = AMP_HTML_Utils::build_tag('script', array('type' => 'application/json'), json_encode($analytics_entry['config_data'])); $amp_analytics_attr = array_merge(array('id' => $id, 'type' => $analytics_entry['type']), $analytics_entry['attributes']); echo AMP_HTML_Utils::build_tag('amp-analytics', $amp_analytics_attr, $script_element); } }
protected function build_attributes_string($attributes) { return AMP_HTML_Utils::build_attributes_string($attributes); }