'amp_story_vp_metabox',
'types' => array('post','page'),
'title' => __('Amp Stories for Wordpress', 'amp_story_metabox_title'),
'priority' => 'high',
'is_dev_mode' => false,
'template' => $mb_path
));
}
// the safest hook to use, since Vafpress Framework may exists in Theme or Plugin
add_action( 'after_setup_theme', 'amp_story_init_metaboxes' );
function amp_story_load_frontend()
{
$amp_story_activated = vp_metabox('amp_story_vp_metabox.amp_story_tg');
$amp_story_primary = vp_metabox('amp_story_vp_metabox.amp_story_tg_primary');
if ($amp_story_primary == 1 && $amp_story_activated == 1 && !is_admin() && (is_single() || is_page() ) ) {
require_once('amp-frontend.php');
die();
}
if (sanitize_text_field($_GET['amp'] == 1) && $amp_story_activated == 1 ) {
require_once('amp-frontend.php');
die();
}
}
add_action( 'wp', 'amp_story_load_frontend' );
function amp_story_add_headers() {
global $post;
$amp_story_activated = vp_metabox('amp_story_vp_metabox.amp_story_tg');
if ( (is_single() || is_page() ) && $amp_story_activated == 1 && !is_admin() ) {
$amp_url = get_permalink(). "?amp=1";
echo '' . "\n";
}
}
add_action( 'wp_head', 'amp_story_add_headers' );
function amp_custom_admin_styles() {
echo '';
}
add_action('admin_head', 'amp_custom_admin_styles');