AMP_Template_Customizer::PANEL_ID, 'return' => rawurlencode( admin_url() ), AMP_CUSTOMIZER_QUERY_VAR => true, ), 'customize.php' ); // Add the theme page. $page = add_theme_page( __( 'AMP', 'amp' ), __( 'AMP', 'amp' ), 'edit_theme_options', $menu_slug ); } function amp_admin_get_preview_permalink() { /** * Filter the post type to retrieve the latest of for use in the AMP template customizer. * * @param string $post_type Post type slug. Default 'post'. */ $post_type = (string) apply_filters( 'amp_customizer_post_type', 'post' ); if ( ! post_type_supports( $post_type, 'amp' ) ) { return; } $post_ids = get_posts( array( 'post_status' => 'publish', 'post_type' => $post_type, 'posts_per_page' => 1, 'fields' => 'ids', ) ); if ( empty( $post_ids ) ) { return false; } $post_id = $post_ids[0]; return amp_get_permalink( $post_id ); }