<?php /** * Global AMP page fallback for unmapped WordPress pages. * * Shared AMP chrome (menu / breadcrumbs / sanitized content / footer). * * @package ElearnPOSH\AMP */ if ( ! defined( 'ABSPATH' ) ) { exit; } require ELEARNPOSH_AMP_TEMPLATES_DIR . 'partials/amp-page-shell-start.php'; $post_id = absint( get_the_ID() ); $post_body_class = 'post-' . $post_id; $page_title = $post_id ? get_the_title( $post_id ) : __( 'Page', 'elearnposh-amp' ); $page_permalink = $post_id ? get_permalink( $post_id ) : home_url( '/' ); $content = ''; if ( $post_id ) { $raw = get_post_field( 'post_content', $post_id ); if ( is_string( $raw ) && '' !== $raw ) { $content = apply_filters( 'the_content', $raw ); if ( function_exists( 'elearnposh_amp_sanitize_amp_fragment' ) ) { $content = elearnposh_amp_sanitize_amp_fragment( $content ); } } } $page_schema = array( '@context' => 'https://schema.org', '@type' => 'WebPage', 'name' => wp_strip_all_tags( $page_title ), 'description' => wp_strip_all_tags( get_the_excerpt( $post_id ) ), 'url' => $page_permalink, 'inLanguage' => get_bloginfo( 'language' ), 'publisher' => array( '@type' => 'Organization', 'name' => 'eLearnPOSH', 'url' => home_url( '/' ), ), ); ?> <!doctype html> <html amp lang="<?php echo esc_attr( get_bloginfo( 'language' ) ); ?>"> <head> <meta charset="utf-8" /> <link rel="shortcut icon" href="<?php echo esc_url( elearnposh_amp_get_favicon_url() ); ?>" type="image/png" /> <title><?php echo esc_html( $page_title ); ?> - eLearnPOSH</title> <link rel="dns-prefetch" href="https://cdn.ampproject.org" /> <?php do_action( 'amp_post_template_head', $this ); ?> <style amp-custom> body { font-family: "Nunito Sans", Arial, sans-serif; margin: 0; padding: 0; padding-top: 100px !important; background: #f6f9fd; color: #0f172a; } <?php elearnposh_amp_output_page_styles( 'global-page', array( 'global-page' ), array() ); ?> </style> <script type="application/ld+json"><?php echo elearnposh_amp_encode_page_schema_json_ld( $page_schema ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></script> <?php elearnposh_amp_output_components( 'course' ); ?> </head> <body class="<?php echo esc_attr( $post_body_class ); ?>"> <?php include ELEARNPOSH_AMP_TEMPLATES_DIR . 'components/menu.php'; ?> <div class="amp-content-wrapper"> <?php include ELEARNPOSH_AMP_TEMPLATES_DIR . 'components/user-notification.php'; ?> <main class="ep-global-page"> <section class="ep-global-hero"> <div class="ep-global-wrap"> <?php elearnposh_amp_render_breadcrumbs(); ?> <h1><?php echo esc_html( $page_title ); ?></h1> </div> </section> <section class="ep-global-body"> <div class="ep-global-wrap"> <article class="ep-global-panel"> <?php if ( $content ) { echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized for AMP above. } else { echo '<p>' . esc_html__( 'Content unavailable.', 'elearnposh-amp' ) . '</p>'; } ?> </article> </div> </section> </main> </div> <?php include ELEARNPOSH_AMP_TEMPLATES_DIR . 'components/footer.php'; ?> <?php do_action( 'amp_post_template_footer' ); ?> </body> </html>