feat(gallery): tambah CPT Galeri, template page-galeri, filter interaktif, dan native lightbox zoom
This commit is contained in:
@@ -904,3 +904,11 @@ function edukarsa_about_page_html() {
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
// Menyuntikkan sub-menu Galeri ke dalam menu utama EduKarsa
|
||||
add_action('admin_menu', function() {
|
||||
// Deteksi parent slug (edukarsa_main_menu atau edukarsa_settings)
|
||||
$parent = menu_page_url('edukarsa_main_menu', false) ? 'edukarsa_main_menu' : 'edukarsa_settings';
|
||||
add_submenu_page( $parent, 'Semua Galeri', '📸 Galeri Fasilitas', 'manage_options', 'edit.php?post_type=galeri' );
|
||||
add_submenu_page( $parent, 'Kategori Galeri', '📂 Kategori Galeri', 'manage_options', 'edit-tags.php?taxonomy=kategori_galeri&post_type=galeri' );
|
||||
}, 100);
|
||||
|
||||
@@ -46,3 +46,30 @@ function edukarsa_slider_save_meta( $post_id ) {
|
||||
if ( isset( $_POST['slider_link'] ) ) { update_post_meta( $post_id, '_slider_link', sanitize_text_field( $_POST['slider_link'] ) ); }
|
||||
}
|
||||
add_action( 'save_post', 'edukarsa_slider_save_meta' );
|
||||
|
||||
// --- REGISTRASI CPT GALERI & TAXONOMY ---
|
||||
function edukarsa_register_galeri_cpt() {
|
||||
register_post_type( 'galeri', array(
|
||||
'labels' => array(
|
||||
'name' => 'Galeri Fasilitas',
|
||||
'singular_name' => 'Galeri',
|
||||
'add_new_item' => 'Tambah Foto Galeri',
|
||||
'all_items' => 'Semua Foto Galeri'
|
||||
),
|
||||
'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),
|
||||
'public' => true,
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => false,
|
||||
'menu_icon' => 'dashicons-format-gallery'
|
||||
));
|
||||
|
||||
register_taxonomy( 'kategori_galeri', 'galeri', array(
|
||||
'labels' => array('name' => 'Kategori Galeri', 'singular_name' => 'Kategori', 'add_new_item' => 'Tambah Kategori'),
|
||||
'hierarchical' => true,
|
||||
'public' => true,
|
||||
'show_ui' => true,
|
||||
'show_admin_column' => true,
|
||||
'show_in_menu' => false
|
||||
));
|
||||
}
|
||||
add_action( 'init', 'edukarsa_register_galeri_cpt', 0 );
|
||||
|
||||
Reference in New Issue
Block a user