Files
edukarsa/inc/setup.php
T

91 lines
3.6 KiB
PHP

<?php
defined( 'ABSPATH' ) || exit;
if ( ! function_exists( 'edukarsa_theme_setup' ) ) {
function edukarsa_theme_setup() {
load_theme_textdomain( 'edukarsa', get_template_directory() . '/languages' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'align-wide' );
add_theme_support( 'wp-block-styles' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'editor-styles' );
add_editor_style( 'style.css' );
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script' ) );
add_theme_support( 'custom-logo', array(
'height' => 110,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
) );
add_theme_support( 'custom-header', array(
'default-image' => '',
'width' => 1920,
'height' => 800,
'flex-height' => true,
) );
add_theme_support( 'custom-background', array(
'default-color' => 'ffffff',
) );
register_nav_menus( array(
'menu-utama' => esc_html__( 'Menu Navigasi Utama', 'edukarsa' ),
'menu-footer' => esc_html__( 'Menu Tautan Footer', 'edukarsa' ),
) );
}
}
add_action( 'after_setup_theme', 'edukarsa_theme_setup' );
function edukarsa_register_block_components() {
if ( function_exists( 'register_block_style' ) ) {
register_block_style( 'core/quote', array(
'name' => 'edukarsa-quote',
'label' => esc_html__( 'EduKarsa Quote', 'edukarsa' ),
) );
}
if ( function_exists( 'register_block_pattern' ) ) {
register_block_pattern(
'edukarsa/cta-banner',
array(
'title' => esc_html__( 'EduKarsa CTA Banner', 'edukarsa' ),
'description' => esc_html__( 'Banner ajakan pendaftaran PMB EduKarsa', 'edukarsa' ),
'content' => '<!-- wp:group {"className":"edukarsa-cta-block"} --><div class="wp-block-group edukarsa-cta-block"><p>' . esc_html__( 'Pendaftaran Mahasiswa / Siswa Baru Telah Dibuka!', 'edukarsa' ) . '</p></div><!-- /wp:group -->',
'categories' => array( 'featured' ),
)
);
}
}
add_action( 'init', 'edukarsa_register_block_components' );
function edukarsa_register_sidebars() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar Utama', 'edukarsa' ),
'id' => 'sidebar-utama',
'description' => esc_html__( 'Area widget untuk bilah samping postingan dan halaman.', 'edukarsa' ),
'before_widget' => '<div id="%1$s" class="card-style sidebar-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="sidebar-widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'edukarsa_register_sidebars' );
function edukarsa_enqueue_scripts() {
wp_enqueue_style( 'edukarsa-style', get_stylesheet_uri(), array(), time() );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( file_exists( get_template_directory() . '/assets/edukarsa.js' ) ) {
wp_enqueue_script( 'edukarsa-global-js', get_template_directory_uri() . '/assets/edukarsa.js', array(), time(), true );
}
}
add_action( 'wp_enqueue_scripts', 'edukarsa_enqueue_scripts' );