<?php

/**
 *   theme Functions 
 * 
 * @package MyNzambaKinga 
 * 
 *  check Url or path of css
 *  echo '<pre>';
 * print_r( get_stylesheet_uri() );
 * wp_die();
 */
function MyNzamba_enqueue_scripts() {

    // Register and enqueue styles
    wp_register_style('style-css', get_stylesheet_uri(), [], fileatime(get_template_directory() . '/style.css'), 'all');
    wp_enqueue_style('style-css');

    wp_register_style('bootstrap-css', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css', [], '4.5.2', 'all');
    wp_enqueue_style('bootstrap-css');

    wp_register_style('bootstrap-icons', 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.10.0/font/bootstrap-icons.min.css', [], '1.10.0', 'all');
    wp_enqueue_style('bootstrap-icons');

    wp_register_style('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css', [], '6.4.0', 'all');
    wp_enqueue_style('font-awesome');

    wp_register_style('aos-css', 'https://cdnjs.cloudflare.com/ajax/libs/aos/2.3.4/aos.css', [], '2.3.4', 'all');
    wp_enqueue_style('aos-css');

    wp_register_style('owl-carousel', 'https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.css', [], '1.3.3', 'all');
    wp_enqueue_style('owl-carousel');
    

    wp_register_style('owl-theme', 'https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.theme.min.css', [], '1.3.3', 'all');
    wp_enqueue_style('owl-theme');

    wp_register_style('main-styles', get_template_directory_uri() . '/assets/css/main-styles.css', [], fileatime(get_template_directory() . '/assets/css/main-styles.css'), 'all');
    wp_enqueue_style('main-styles');

    // Enqueue the default jQuery
    wp_enqueue_script('jquery');

    // Register and enqueue scripts with jQuery as a dependency where needed
    wp_register_script('popper-js', 'https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js', ['jquery'], '2.5.4', true);
    wp_enqueue_script('popper-js');

    wp_register_script('bootstrap-js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js', ['jquery', 'popper-js'], '4.5.2', true);
    wp_enqueue_script('bootstrap-js');

    wp_register_script('aos-js', 'https://cdnjs.cloudflare.com/ajax/libs/aos/2.3.4/aos.js', [], '2.3.4', true);
    wp_enqueue_script('aos-js');

    wp_register_script('ionicons-esm', 'https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js', [], '5.5.2', true);
    wp_enqueue_script('ionicons-esm');

    wp_register_script('ionicons', 'https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js', [], '5.5.2', true);
    wp_enqueue_script('ionicons');

    wp_register_script('owl-carousel-js', 'https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js', ['jquery'], '1.3.3', true);
    wp_enqueue_script('owl-carousel-js');

    wp_register_script('main-js', get_template_directory_uri() . '/assets/js/main.js', [], fileatime(get_template_directory() . '/assets/js/main.js'), true);
    wp_enqueue_script('main-js');

    wp_register_script('script-js', get_template_directory_uri() . '/assets/js/script.js', [], fileatime(get_template_directory() . '/assets/js/script.js'), true);
    wp_enqueue_script('script-js');
}

add_action('wp_enqueue_scripts', 'MyNzamba_enqueue_scripts');


// theme option and theme support

add_theme_support('menus');
add_theme_support('post-thumbnails');
add_theme_support('widgets');

// Menus 

register_nav_menus(

	array(
		'top-menu' => 'Top Menu Location',
		'mobile-menu' => 'Mobile Menu Location',
		'footer-menu' => 'Footer Menu Location',

	)
);




// Include custom nav walker
require_once get_template_directory() . '/class-wp-bootstrap-navwalker.php';



// custom post type for team members  and staffs

function our_team_member() {
    $args = array(
        'labels' => array(
            'name' => 'Team Members',
            'singular_name' => 'Team Member'
        ),
        'public' => true,
        'has_archive' => true,
        'menu_icon' => 'dashicons-admin-users', 
        'rewrite' => array('slug' => 'team', 'with_front' => false),
        'supports' => array('title', 'editor', 'thumbnail'),
    );

    register_post_type('team', $args);
}
add_action('init', 'our_team_member');





function taxonomy_team() {
    $labels = array(
        'name'              => _x('Staff', 'taxonomy general name'),
        'singular_name'     => _x('Staff Member', 'taxonomy singular name'),
        'search_items'      => __('Search Staff'),
        'all_items'         => __('All Staff'),
        'parent_item'       => __('Parent Staff Member'),
        'parent_item_colon' => __('Parent Staff Member:'),
        'edit_item'         => __('Edit Staff Member'),
        'update_item'       => __('Update Staff Member'),
        'add_new_item'      => __('Add New Staff Member'),
        'new_item_name'     => __('New Staff Member Name'),
        'menu_name'         => __('Staff'),
    );

    $args = array(
        'labels'            => $labels,
        'public'            => true,
        'hierarchical'      => false, // Use true if you need parent-child relationships
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        'rewrite'           => array('slug' => 'staff'), // Ensure the rewrite slug is specified
    );

    register_taxonomy('staff', array('team'), $args);

}

add_action('init', 'taxonomy_team');



function practice_areas() {
    $args = array(
        'labels' => array(
            'name' => 'Legal Work',
            'singular_name' => 'Legal Work'
        ),
        'public' => true,
        'has_archive' => true,
        'menu_icon' => 'dashicons-admin-page', 
        'rewrite' => array('slug' => 'legal', 'with_front' => false),
        'supports' => array('title', 'editor', 'thumbnail'),
    );

    register_post_type('legal', $args);
}
add_action('init', 'practice_areas');

function taxonomy_legal() {
    $labels = array(
        'name'              => _x('Legal Areas', 'taxonomy general name'),
        'singular_name'     => _x('Legal Area', 'taxonomy singular name'),
        'search_items'      => __('Search Legal Areas'),
        'all_items'         => __('All Legal Areas'),
        'parent_item'       => __('Parent Legal Area'),
        'parent_item_colon' => __('Parent Legal Area:'),
        'edit_item'         => __('Edit Legal Area'),
        'update_item'       => __('Update Legal Area'),
        'add_new_item'      => __('Add New Legal Area'),
        'new_item_name'     => __('New Legal Area Name'),
        'menu_name'         => __('Legal Areas'),
    );

    $args = array(
        'labels'            => $labels,
        'public'            => true,
        'hierarchical'      => false, // Set to true if you want parent-child relationships
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        'rewrite'           => array('slug' => 'legal-area'), // Ensure the rewrite slug is specified
    );

    register_taxonomy('legal-area', array('legal'), $args); // Ensure 'legal' post type exists
}

add_action('init', 'taxonomy_legal');




?>