get_settings(); $this->get_view()->render_html("settings/general", array('settings' => $data), true); } /** * Get Settings * * @return mixed */ public function get_settings() { $mp_timetable_general = array( 'theme_mode' => 'theme', ); $settings = get_option('mp_timetable_general', $mp_timetable_general); if ($this->is_theme_supports()) { $settings['theme_mode'] = 'plugin'; } return $settings; } /** * Theme supports plugin mode. * * @return string */ public function is_theme_supports() { return current_theme_supports('mp-timetable'); } /** * Save meta data Column post type * */ public function save_settings() { if ( current_user_can('manage_options') && !empty( $_POST['theme_mode'] ) ) { $options = array(); $options['theme_mode'] = sanitize_key( $_POST['theme_mode'] ); update_option('mp_timetable_general', $options); } } /** * Check whether to use single room template from plugin * * @return bool */ public function is_plugin_template_mode() { return ($this->get_template_mode() === 'plugin'); } /** * Retrieve template mode. Possible values: plugin, theme. * * @return string */ public function get_template_mode() { $options = $this->get_settings(); return isset($options['theme_mode']) ? $options['theme_mode'] : 'theme'; } }