Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

FinancePro_settingspage

class FinancePro_Settings_Page {

	public function __construct() {

		add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
		add_action( 'admin_init', array( $this, 'init_settings'  ) );

	}

	public function add_admin_menu() {

		add_menu_page(
			'Finance Professionals Group AS',
			'Finance Pro',
			'manage_options',
			'finance_professionals',
			array( $this, 'page_layout' ),
			'/wp-content/uploads/ikon26.png',
			5
		);

	}

	public function init_settings() {

		register_setting(
			'finpro_settings_group',
			'finpro_settings_name'
		);

		add_settings_section(
			'finpro_settings_name_section',
			'',
			false,
			'finpro_settings_name'
		);

		add_settings_field(
			'banduroChatbotId',
			'Banduro Chatbot ID',
			array( $this, 'render_banduroChatbotId_field' ),
			'finpro_settings_name',
			'finpro_settings_name_section'
		);

	}

	public function page_layout() {

		// Check required user capability
		if ( !current_user_can( 'manage_options' ) )  {
			wp_die( 'You do not have sufficient permissions to access this page.' );
		}

		// Admin Page Layout
		echo '<div class="wrap">' . "n";
		echo '	<h1>' . get_admin_page_title() . '</h1>' . "n";
		echo '	<form action="options.php" method="post">' . "n";

		settings_fields( 'finpro_settings_group' );
		do_settings_sections( 'finpro_settings_name' );
		submit_button();

		echo '	</form>' . "n";
		echo '</div>' . "n";

	}

	function render_banduroChatbotId_field() {

		// Retrieve data from the database.
		$options = get_option( 'finpro_settings_name' );

		// Set default value.
		$value = isset( $options['banduroChatbotId'] ) ? $options['banduroChatbotId'] : '';

		// Field output.
		echo '<input type="text" name="finpro_settings_name[banduroChatbotId]" class="regular-text banduroChatbotId_field" placeholder="' . '' . '" value="' . esc_attr( $value ) . '">';
		echo '<p class="description">' . 'banduroChatbotId - La stå tom for å deaktivere' . '</p>';

	}

}

new FinancePro_Settings_Page;