* @copyright Copyright (c) 2018, Radiuzz * @link http://caelum.radiuzz.com * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 or later */ /** * Register and load admin javascript */ function caelum_admin_js($hook) { if ($hook == 'post.php' || $hook == 'post-new.php') { wp_register_script('caelum-metabox', get_template_directory_uri() . '/inc/metabox/js/metabox.js'); wp_enqueue_script('caelum-metabox'); } } add_action('admin_enqueue_scripts','caelum_admin_js',10,1); /** * Registering meta boxes * */ add_filter( 'rwmb_meta_boxes', 'caelum_Format_Metabox' ); /** Register meta boxes **/ function caelum_Format_Metabox( $meta_boxes ) { // Better has an underscore as last sign $prefix = 'caelum_'; // Gallery Format Metabox $meta_boxes[] = array( 'id' => 'caelum_gallery_format_metabox', 'title' => esc_html__( 'Gallery Format Options', 'caelum' ), 'post_types' => array( 'post' ), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array( // IMAGE ADVANCED (WP 3.5+) array( 'name' => esc_html__( 'Upload Gallery Images', 'caelum' ), 'id' => "{$prefix}gallery_format", 'type' => 'image_advanced', 'max_file_uploads' => 10, ), ) ); // Video Format Metabox $meta_boxes[] = array( 'id' => 'caelum_video_format_metabox', 'title' => esc_html__( 'Video Format Options', 'caelum' ), 'post_types' => array( 'post' ), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array( // TEXTAREA array( 'name' => esc_html__( 'Video Embed Code', 'caelum' ), 'id' => "{$prefix}video_format", 'type' => 'textarea', 'cols' => 20, 'rows' => 4, ), ) ); // Audio Format Metabox $meta_boxes[] = array( 'id' => 'caelum_audio_format_metabox', 'title' => esc_html__( 'Audio Format Options', 'caelum' ), 'post_types' => array( 'post' ), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array( // TEXTAREA array( 'name' => esc_html__( 'Audio Embed Code', 'caelum' ), 'id' => "{$prefix}audio_format", 'type' => 'textarea', 'cols' => 20, 'rows' => 4, ), ) ); // Link Format Metabox $meta_boxes[] = array( 'id' => 'caelum_link_format_metabox', 'title' => esc_html__( 'Link Format Options', 'caelum' ), 'post_types' => array( 'post' ), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array( // TEXTAREA array( 'name' => esc_html__( 'Site URL', 'caelum' ), 'id' => "{$prefix}link_format", 'type' => 'text', ), ) ); return $meta_boxes; }