Inventory_Presser_Options::add_settings()

add_settings


Description Description

Registers sections and settings using the Settings API.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class-dealership-options.php

			plugins_url( '/js/page-settings.min.js', INVP_PLUGIN_FILE_PATH ),
			array( 'jquery' )
		);
	}
	
	/**
	 * add_options_page
	 * 
	 * Adds an options page to the dashboard to hold all this plugin's settings.
	 *
	 * @return void
	 */
	public function add_options_page()
	{
		if ( post_type_exists( INVP::POST_TYPE ) )
		{
			add_submenu_page('edit.php?post_type=' . INVP::POST_TYPE,
				__( 'Options', 'inventory-presser' ), // page_title
				__( 'Options', 'inventory-presser' ), // menu_title
				'manage_options', // capability
				'dealership-options', // menu_slug
				array( $this, 'options_page_content' ) // function
			);
			return;
		}

		add_options_page(
			__( 'Inventory Presser', 'inventory-presser' ), // page_title
			__( 'Inventory Presser', 'inventory-presser' ), // menu_title
			'manage_options', // capability
			'dealership-options', // menu_slug
			array( $this, 'options_page_content' ) // function
		);
	}
	
	/**
	 * add_settings
	 * 
	 * Registers sections and settings using the Settings API.
	 *
	 * @return void
	 */
	public function add_settings()
	{
		register_setting(
			'dealership_options_option_group', // option_group
			INVP::OPTION_NAME, // option_name
			array( $this, 'sanitize_options' ) // sanitize_callback
		);

		/**
		 * SECTION Settings
		 */
		add_settings_section(
			'dealership_options_setting_section', // id
			__( 'General', 'inventory-presser' ), // title
			'__return_empty_string', // callback
			'dealership-options-admin' // page
		);

		//Price Display
		add_settings_field(
			'price_display', // id
			__( 'Price Display', 'inventory-presser' ), // title
			array( $this, 'callback_price_display' ), // callback
			'dealership-options-admin', // page
			'dealership_options_setting_section' // section
		);

		//[x] Include sold vehicles
		add_settings_field(
			'include_sold_vehicles', // id
			__( 'Sold Vehicles', 'inventory-presser' ), // title
			array( $this, 'callback_include_sold_vehicles' ), // callback
			'dealership-options-admin', // page
			'dealership_options_setting_section' // section
		);

		//[x] Show all taxonomies under Vehicles menu in Dashboard
		add_settings_field(
			'show_all_taxonomies', // id
			__( 'Show All Taxonomies', 'inventory-presser' ), // title
			array( $this, 'callback_show_all_taxonomies' ), // callback
			'dealership-options-admin', // page
			'dealership_options_setting_section' // section
		);

		//[x] Skip trash when deleting vehicles and delete permanently
		add_settings_field(
			'skip_trash', // id
			__( 'Skip Trash', 'inventory-presser' ), // title
			array( $this, 'callback_skip_trash' ), // callback
			'dealership-options-admin', // page
			'dealership_options_setting_section' // section
		);

		/**
		 * SECTION Listings
		 */
		add_settings_section(
			'dealership_options_section_listings', // id
			__( 'Listings', 'inventory-presser' ), // title
			'__return_empty_string', // callback
			'dealership-options-admin' // page