From 226e09f2b11dc60e17e5cb793b79c53949c030fc Mon Sep 17 00:00:00 2001 From: Mas Budi Kusuma Date: Tue, 15 Sep 2026 21:08:52 +0700 Subject: [PATCH] feat(layout): menambahkan sidebar native dan layout 2 kolom pada single.php --- inc/setup.php | 92 +++++++++++++++++++++++++++----------------------- sidebar.php | 66 ++++++++++++++++++++++++++++++++++++ single.php | 93 ++++++++++++++++++++++++++++----------------------- style.css | 9 ++++- 4 files changed, 177 insertions(+), 83 deletions(-) create mode 100644 sidebar.php diff --git a/inc/setup.php b/inc/setup.php index b713c49..45ea5a0 100644 --- a/inc/setup.php +++ b/inc/setup.php @@ -1,41 +1,51 @@ - __( 'Menu Utama', 'edukarsa' ), - 'menu-footer' => __( 'Menu Footer', 'edukarsa' ), - ) ); -} -add_action( 'after_setup_theme', 'edukarsa_setup' ); - -// 2. MENGHUBUNGKAN ASET (CSS & JS FRONTEND) -function edukarsa_scripts() { - // Memaksa path absolut langsung ke folder tema - wp_enqueue_style( - 'edukarsa-style', - get_template_directory_uri() . '/style.css', - array(), - time(), - 'all' - ); -} -add_action( 'wp_enqueue_scripts', 'edukarsa_scripts' ); - -// 3. MEMUAT JAVASCRIPT UNTUK MEDIA UPLOADER (DASHBOARD) -function edukarsa_admin_scripts( $hook ) { - // Memastikan skrip uploader dipanggil di halaman pengaturan Edukarsa[cite: 9] - if ( strpos( $hook, 'edukarsa' ) !== false ) { - wp_enqueue_media(); - } -} -add_action( 'admin_enqueue_scripts', 'edukarsa_admin_scripts' ); \ No newline at end of file + __( 'Menu Utama', 'edukarsa' ), + 'menu-footer' => __( 'Menu Footer', 'edukarsa' ), + ) ); +} +add_action( 'after_setup_theme', 'edukarsa_setup' ); + +// 2. MENGHUBUNGKAN ASET (CSS & JS FRONTEND) +function edukarsa_scripts() { + wp_enqueue_style( + 'edukarsa-style', + get_template_directory_uri() . '/style.css', + array(), + time(), + 'all' + ); +} +add_action( 'wp_enqueue_scripts', 'edukarsa_scripts' ); + +// 3. MEMUAT JAVASCRIPT UNTUK MEDIA UPLOADER (DASHBOARD) +function edukarsa_admin_scripts( $hook ) { + if ( strpos( $hook, 'edukarsa' ) !== false ) { + wp_enqueue_media(); + } +} +add_action( 'admin_enqueue_scripts', 'edukarsa_admin_scripts' ); + +// 4. REGISTRASI AREA WIDGET SIDEBAR +function edukarsa_widgets_init() { + register_sidebar( array( + 'name' => __( 'Sidebar Artikel', 'edukarsa' ), + 'id' => 'sidebar-artikel', + 'description' => __( 'Area widget untuk halaman single berita/artikel.', 'edukarsa' ), + 'before_widget' => '', + 'before_title' => '', + ) ); +} +add_action( 'widgets_init', 'edukarsa_widgets_init' ); diff --git a/sidebar.php b/sidebar.php new file mode 100644 index 0000000..47e4162 --- /dev/null +++ b/sidebar.php @@ -0,0 +1,66 @@ + + diff --git a/single.php b/single.php index 2f7cddf..031681b 100644 --- a/single.php +++ b/single.php @@ -1,55 +1,66 @@ -
- +
+
+ +
style="padding: 40px;"> - -
-

- -

- -
- - -
- 'width: 100%; height: auto; display: block;' ) ); ?> -
- - -
- - wp_link_pages( array( - 'before' => '', - ) ); + -
+
+

+ +

+ +
- + +
+ 'width: 100%; height: auto; display: block;' ) ); ?> +
+ +
+ '', + ) ); + ?> +
+ + +
- + + + + +