<?php

/**
 * Theme Settings
 *
 * @package Dotspice
 * @version 1.3.0
 */

if (!function_exists('acf_add_options_page')) {
	return;
}


/**
 * Theme Settings Options Page
 */
function dotspice_settings_page()
{
	acf_add_options_page(array(
		'page_title' => false,
		'menu_title' => __('Dotspice', 'dotspice'),
		'menu_slug'  => 'theme-settings',
		'capability' => 'administrator',
		'position'   => '2', // '58.374981',
		'redirect'   => false,
	));
}
add_action('init', 'dotspice_settings_page');


/**
 * Theme Settings Wordpress Page Fix
 */
function dotspice_wp_settings_page()
{
	add_menu_page(__('Settings', 'dotspice'), __('Settings', 'dotspice'), 'administrator', 'theme-settings', '', '', '58.374981');
}
add_action('admin_menu', 'dotspice_wp_settings_page', 9);


/**
 * Remove Duplicate Admin Menu
 */
function dotspice_unset_double_settings_page()
{
	global $menu;

	foreach ($menu as $key => $values) {
		if (isset($values[2]) && $values[2] == 'theme-settings') {
			unset($menu[$key]);

			break;
		}
	}
}
add_action('admin_menu', 'dotspice_unset_double_settings_page', 100);
