<?php

function slidermenuadmin(){
    add_menu_page('Slider','Slider','','submenuslider','func_addslider','dashicons-slides');
    add_submenu_page('submenuslider','All Sliders','All Sliders','manage_options','allslider','func_allslider');
    add_submenu_page('submenuslider','Add Slider','Add Slider','manage_options','addslider','func_addslider');
}

function func_allslider(){
    global $wpdb;
    wp_enqueue_style('bootstrap', get_template_directory_uri() .'/css/bootstrap.min.css');
    wp_enqueue_style('cssSlider', plugins_url('jaas-slider/css/slider.css'));
    wp_enqueue_script('upload', plugins_url('jaas-slider/js/uploader.js'));
    wp_enqueue_media();
    if(($_GET['edit']) == true){
        include('function/edit_slider.php');
    }else{
        include('function/all_slider.php');
    }
}

function func_addslider(){
    global $wpdb;
    wp_enqueue_style('bootstrap', get_template_directory_uri() .'/css/bootstrap.min.css');
    wp_enqueue_script('upload', plugins_url('jaas-slider/js/uploader.js'));
    wp_enqueue_media();
    include('function/add_slider.php');
}

add_action('admin_menu','slidermenuadmin');

add_shortcode('slider', "func_slider");

function func_slider(){
    global $wpdb;
    wp_enqueue_script('script', plugins_url('jaas-slider/js/script.js'));
    wp_enqueue_script('slick', plugins_url('jaas-slider/js/slick.min.js'));
    wp_enqueue_script('jmagnific', plugins_url('jaas-slider/js/jquery.magnific-popup.min.js'));
    include('views/jaas-slider.php');
}

?>