faq_setting_menu(); } public function enqueue_styles_and_scripts($hook_suffix){ $deps = array('jquery','wp-color-picker'); wp_register_style('thfaq-admin-styles', THFAQ_ASSETS_URL_ADMIN. 'css/admin.css'); wp_register_style('select2css', THFAQ_ASSETS_URL_ADMIN. 'css/select2.min.css'); wp_register_script('select2', THFAQ_ASSETS_URL_ADMIN. 'js/select2.min.js', array('jquery'), '1.0', true); wp_enqueue_style('select2css'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('select2'); wp_enqueue_script('iris'); wp_enqueue_media(); wp_enqueue_script('thfaq-admin-scripts', THFAQ_ASSETS_URL_ADMIN. 'js/admin.js', $deps, true); wp_enqueue_style('thfaq-admin-styles'); } public function get_manage_settings_fields(){ return array( 'color_title' => array( 'type' => 'content', 'value' => 'Display Settings', 'class' => 'thfaq-settings-section-title', 'colspan' => '4', ), 'color_description' => array( 'type' => 'content', 'value' => 'Apply Display Color for FAQs. Colors can be also set for Individual FAQs at Corresponding FAQ.', 'colspan' => '4', ), 'title_color' => array( 'label' => __( 'Title Text Color', 'woocommerce'), 'class' => 'thpladmin-colorpicker', 'type' => 'color-picker', 'wrapper' => 'h5', 'value' => '#000000', ), 'title_bg_color' => array( 'label' => __( 'Title Background Color', 'woocommerce' ), 'class' => 'thpladmin-colorpicker', 'wrapper' => 'h5', 'type' => 'color-picker', 'value' => '#ccd0cc', ), 'content_color' => array( 'label' => __( 'Content Text Color', 'woocommerce' ), 'class' => 'thpladmin-colorpicker', 'wrapper' => 'h5', 'type' => 'color-picker', 'value' => '#000000;', ), 'content_bg_color' => array( 'label' => __( 'Content Background Color', 'woocommerce' ), 'class' => 'thpladmin-colorpicker', 'wrapper' => 'h5', 'type' => 'color-picker', 'value' => '#ccd0cc', ), 'accordion_options' => array( 'type' => 'content', 'value' => 'Accordion Options', 'class' => 'thfaq-settings-section-title', 'colspan' => '4', ), 'accordion_display_style_on_load' => array( 'label' => __( 'Accordion Style While Loading', 'woocommerce' ), 'wrapper' => 'h5', 'class' => '', 'type' => 'select', 'options' => array( 'open' => __( 'Open First FAQ', 'woocommerce' ), 'close' => __( 'Close All FAQs', 'woocommerce' ), ), 'value' => 'open', ), 'open_multiple_faqs' => array( 'label' => __( 'Keep Multiple FAQ Tab Open On Click', 'woocommerce' ), 'type' => 'checkbox', 'wrapper' => 'h5', 'value' => '', ), 'show_updated_date' =>array( 'label' => __( 'Display Updated Date For FAQs', 'woocommerce' ), 'type' => 'checkbox', 'wrapper' => 'h5', 'value' => '', ), 'social_share_settings' => array( 'type' => 'content', 'value' => 'Social Share Settings', 'class' => 'thfaq-settings-section-title', 'colspan' => '4', ), 'enable_share_button' =>array( 'label' => __( 'Enable Social Share Option for FAQs', 'woocommerce' ), 'type' => 'checkbox_enable_btn', 'wrapper' => 'h5', 'value' => '', 'colspan' => '4', ), 'share_button_title' => array( 'label' => __( 'Share Button Title', 'woocommerce' ), 'wrapper' => 'h5', 'class' => '', 'type' => 'text', 'value' => '', ), 'social_share_options' =>array( 'label' => __( 'Add Share Buttons', 'woocommerce' ), 'wrapper' => 'h5', 'class' => '', 'type' => 'multiselect', 'options' => array( 'facebook' => __( 'Facebook', 'woocommerce' ), 'twitter' => __( 'Twitter', 'woocommerce' ), 'linkedin' => __( 'Linkedin', 'woocommerce' ), 'email' => __( 'Email', 'woocommerce' ), ), 'value' => '', ) ); } public function faq_setting_menu() { add_submenu_page('edit.php?post_type=faq', 'Settings', 'Settings', 'manage_options', 'faq-settings', array($this,'faq_setting_entring')); } public function faq_setting_entring(){ if(!current_user_can('manage_options')){ wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } if(isset($_POST["reset"])){ $this->delete_option(); } if(isset($_POST["submit"])){ $this->save_settings(); } $this->render_settings(); } public function render_settings(){ $new_obj = new THFAQ_Admin_Manage_Settings; $fieldset = $new_obj->get_manage_settings_fields(); $saved_settings = get_option('faq_settings'); $eurl = get_admin_url(); $k = 0; $Share_button_title = isset($saved_settings['share_button_title'])? $saved_settings['share_button_title']:""; $checked_multiple_open_faqs = isset($saved_settings['open_multiple_faqs']) ? $saved_settings['open_multiple_faqs'] : ""; ?>
Settings successfully reset.
Error restoring, Please try again.