'align-middle', 'label_for' => 'frontend_uri', ) ); add_settings_field( 'secret_key', __( 'Secret Key', 'faustwp' ), __NAMESPACE__ . '\\display_secret_key_field', 'faustwp-settings', 'settings_section', array( 'class' => 'align-middle', 'label_for' => 'secret_key', ) ); add_settings_field( 'menu_locations', __( 'Menu Locations', 'faustwp' ), __NAMESPACE__ . '\\display_menu_locations_field', 'faustwp-settings', 'settings_section', array( 'class' => 'align-middle', 'label_for' => 'menu_locations', ) ); add_settings_field( 'enable_disable', __( 'Features', 'faustwp' ), __NAMESPACE__ . '\\display_enable_disable_fields', 'faustwp-settings', 'settings_section' ); } add_action( 'load-settings_page_faustwp-settings', __NAMESPACE__ . '\\handle_regenerate_secret_key', 5 ); /** * Callback for WordPress 'load-{$page_hook}' action. * * Nonce set in WPE\FaustWP\Settings\display_secret_key_field(). * * Regenerate the secret key. * * @return void */ function handle_regenerate_secret_key() { $screen = get_current_screen(); if ( 'settings_page_faustwp-settings' !== $screen->id ) { return; } if ( empty( $_GET['regenerate_nonce'] ) ) { return; } if ( ! current_user_can( 'manage_options' ) ) { return; } check_admin_referer( 'regenerate_secret', 'regenerate_nonce' ); faustwp_update_setting( 'secret_key', wp_generate_uuid4() ); wp_safe_redirect( admin_url( '/options-general.php?page=faustwp-settings' ) ); exit; } /** * Callback for add_submenu_page() function. * * Display the settings page. * * @return void */ function display_settings_page() { require FAUSTWP_DIR . '/includes/settings/views/headless-settings.php'; } /** * Callback for WordPress add_settings_field() method parameter. * * Display the "Menu Locations" text field. * * @return void */ function display_menu_locations_field() { $menu_locations = faustwp_get_setting( 'menu_locations', 'Primary, Footer' ); ?>

headless post previews.', 'faustwp' ) ), 'https://faustjs.org/docs/next/guides/post-page-previews' ); ?>




array_key_exists( 'wp-graphql/wp-graphql.php', get_plugins() ), 'strings' => array( 'default' => esc_html__( 'Install and Activate', 'faustwp' ), 'installing' => esc_html__( 'Installing…', 'faustwp' ), 'active' => esc_html__( 'WPGraphQL is active', 'faustwp' ), 'failed' => esc_html__( 'Installation failed', 'faustwp' ), ), ); wp_localize_script( 'faustwp-wpgraphql-install', 'faustwp', $faustwp ); } } add_filter( 'plugin_action_links_faustwp/faustwp.php', __NAMESPACE__ . '\\add_action_link_settings' ); /** * Adds a link to the Settings page on the Installed Plugins page. * * @param array $links The array of plugin action links. */ function add_action_link_settings( $links ) { $url = add_query_arg( 'page', 'faustwp-settings', admin_url( 'options-general.php' ) ); return array_merge( array( '' . esc_html__( 'Settings', 'faustwp' ) . '', ), $links ); }