. * */ if (!defined('THEME_OPTIONS_DIR')) { add_option('theme_options_dir', dirname(__FILE__) . '/'); add_option('theme_options_url', WP_CONTENT_URL . '/plugins/theme-options/'); add_option('theme_snippets_dir', dirname(__FILE__) . '/snippets/'); add_option('theme_snippets_url', WP_CONTENT_URL . '/plugins/theme-options/snippets/'); define( 'THEME_OPTIONS_DIR', get_option('theme_options_dir') ); define( 'THEME_OPTIONS_URL', get_option('theme_options_url') ); define( 'THEME_SNIPPETS_DIR', get_option('theme_snippets_dir') ); define( 'THEME_SNIPPETS_URL', get_option('theme_snippets_url') ); function theme_options_load_translation_file() { $plugin_path = plugin_basename(dirname( __FILE__ ) . '/translations'); load_plugin_textdomain( 'theme_options', '', $plugin_path ); } add_action('init', 'theme_options_load_translation_file'); // Include files with useful code include_once THEME_OPTIONS_DIR . 'library/snippet_functions.php'; include_once THEME_OPTIONS_DIR . 'library/panel_page.php'; include_once THEME_OPTIONS_DIR . 'library/options_page.php'; // Attach the 'Theme Options' Panel page add_action('admin_menu', 'attach_theme_options_panel_page'); //This adds a sub-page to the Appearance menu function attach_theme_options_panel_page() { add_theme_page('Theme Options Panel', 'Theme Options Panel', 8, theme_options_panel_page, theme_options_panel_page); } // Attach the Snippet Options Page add_action('admin_menu', 'attach_theme_options_snippets_page'); function attach_theme_options_snippets_page() { add_theme_page('Snippet Options', 'Snippet Options', 8, theme_options_snippets_page, theme_options_snippets_page); } // Run Active Code Snippets $snippets = (array)get_option('active_snippets'); for ($e=0; $e