'string', 'description' => esc_html__( 'BugHerd Project Key', 'bugherd' ), 'sanitize_callback' => 'sanitize_text_field', 'show_in_rest' => true, 'default' => '', ]); // Enable BugHerd in WP Admin register_setting( 'bugherd_settings', 'bugherd_enable_admin', [ 'type' => 'boolean', 'description' => esc_html__( 'Enable BugHerd in wp-admin?', 'bugherd' ), 'sanitize_callback' => 'sanitize_text_field', 'show_in_rest' => true, 'default' => false, ]); // Query Params for Disabling BugHerd register_setting( 'bugherd_settings', 'bugherd_disable_query_params', [ 'type' => 'string', 'description' => esc_html__( 'Comma-separated list of query parameters to disable BugHerd.', 'bugherd' ), 'sanitize_callback' => 'sanitize_text_field', 'show_in_rest' => true, 'default' => false, ]); // Add Fields add_settings_field( 'bugherd_project_key_field', __( 'Project Key', 'bugherd' ), 'bugherd_project_key_settings_field', 'bugherd_settings', 'bugherd_settings' ); add_settings_field( 'bugherd_enable_admin_field', __( 'Enable BugHerd in wp-admin?', 'bugherd' ), 'bugherd_enable_admin_settings_field', 'bugherd_settings', 'bugherd_settings' ); add_settings_field( 'bugherd_disable_query_params_field', __( 'Query Parameters to Disable BugHerd', 'bugherd' ), 'bugherd_disable_query_params_settings_field', 'bugherd_settings', 'bugherd_settings' ); } function bugherd_project_key_settings_field() { printf( '

%s

', esc_attr( get_option( 'bugherd_project_key' ) ), esc_html__( 'Leave blank to disable plugin.', 'bugherd' ) ); } function bugherd_enable_admin_settings_field() { printf( '', checked( get_option( 'bugherd_enable_admin' ), '1', false ), esc_html__( 'Show BugHerd on WP Admin pages?', 'bugherd' ) ); } function bugherd_disable_query_params_settings_field() { printf( '

%s

', esc_attr( get_option( 'bugherd_disable_query_params', 'disable_bugherd, bricks, elementor, no_bugherd' ) ), esc_html__( 'Enter query parameters (comma-separated) to disable BugHerd. Example: bricks, elementor' ) ); } function bugherd_options_page() { echo '
'; // Logo printf( '', esc_url( plugin_dir_url( __DIR__ ) ), 'assets/images/logo-web.png' ); // Tagline printf( '

%s
%s

', esc_html__( 'The Visual Feedback', 'bugherd' ), esc_html__( 'Tool for Websites', 'bugherd' ) ); echo '
'; // Intro printf( '

%s %s

', esc_html__( 'To install BugHerd on this site simply add your BugHerd Project Key to the field below. Not sure where to find your Project Key?', 'bugherd' ), esc_url( 'https://support.bugherd.com/hc/en-us/articles/360002121575' ), esc_html__( 'Check out this help article.', 'bugherd' ) ); settings_fields( 'bugherd_settings' ); do_settings_sections( 'bugherd_settings' ); // Submit button printf( '
%1$s

%2$s %3$s

', get_submit_button(), esc_html__( 'Need help? Try', 'bugherd' ), esc_url( 'https://support.bugherd.com' ) ); echo '
'; echo '
'; }