ID ) ); exit; } return; } if ( $is_amp_endpoint ) { amp_prepare_render(); } else { amp_add_frontend_actions(); } } function amp_load_classes() { require_once( AMP__DIR__ . '/includes/class-amp-post-template.php' ); // this loads everything else } function amp_add_frontend_actions() { require_once( AMP__DIR__ . '/includes/amp-frontend-actions.php' ); } function amp_add_post_template_actions() { require_once( AMP__DIR__ . '/includes/amp-post-template-actions.php' ); } function amp_prepare_render() { add_action( 'template_redirect', 'amp_render' ); } function amp_render() { amp_load_classes(); $post_id = get_queried_object_id(); do_action( 'pre_amp_render_post', $post_id ); amp_add_post_template_actions(); $template = new AMP_Post_Template( $post_id ); $template->load(); exit; }