plugin_name = $plugin_name; $this->version = $version; } public function enqueue_styles() { wp_enqueue_style( $this->plugin_name, plugin_dir_url(__FILE__) . 'css/gallery-admin.css', array(), $this->version, 'all' ); // Add Dashicons for feature icons wp_enqueue_style('dashicons'); } public function enqueue_scripts() { wp_enqueue_media(); wp_enqueue_script( $this->plugin_name, plugin_dir_url(__FILE__) . 'js/gallery-admin.js', array('jquery'), $this->version, false ); } public function add_admin_menu() { add_management_page( 'Advanced Gallery Fields Settings', 'Advanced Gallery Fields', 'manage_options', 'advanced-gallery-fields', array($this, 'display_settings_page') ); } public function register_settings() { register_setting( 'advanced_gallery_settings', 'advanced_gallery_post_types', array( 'type' => 'array', 'sanitize_callback' => array($this, 'sanitize_post_types'), ) ); } /** * Sanitize the post types array * * @param array $input Array of post types to sanitize * @return array Sanitized array of post types */ public function sanitize_post_types($input) { if (!is_array($input)) { return array('post'); } return array_map('sanitize_key', $input); } public function display_settings_page() { $post_types = get_post_types(['public' => true], 'objects'); $saved_post_types = get_option('advanced_gallery_post_types', ['post']); ?>
Enhance your content with beautiful, customizable galleries