<?php

if( ! function_exists( 'ES_menu' ) ) {
    function ES_menu() {

        // if( ! @function_exists( remove_menu_page( 'jet-dashboard' ) ) ) remove_menu_page( 'jet-dashboard' );

        if ( is_plugin_active( 'jet-blocks/jet-blocks.php' ) ) {
                remove_menu_page( 'jet-dashboard' );
        }

        add_menu_page( 
            'تنظیمات جت',
            'تنظیمات جت',
            'manage_options',
            'admin.php?page=jet-dashboard-settings-page',
            '',
            'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAASCAMAAAC6q9RHAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAD9QTFRFAAAA////////////////////////////////////////////////////////////////////////////////Q7v6agAAABV0Uk5TAGCf3/8wz0Dv8JDAoNCwgL+PX1DgyMNPEQAAAF9JREFUeJxtzkcSwCAIAECM2DXV/781tJl4CKcFAQHgcJtHH1ghIkckpizEQlUjVoAmaNVRhzwnWdHZShjEXQlcPn689qyzsjNbon+d182Xle8GSJZkuXmIh848feIMLzH6AygC2uZPAAAAAElFTkSuQmCC
            ',
            30
        );
        
        if ( is_plugin_active( 'jet-theme-core/jet-theme-core.php' ) ) {
            add_submenu_page(
                'admin.php?page=jet-dashboard-settings-page',
                'قالب ساز',
                'قالب ساز',
                'manage_options',
                'edit.php?post_type=jet-theme-core',
            );        
        } 

        if ( is_plugin_active( 'jet-woo-builder/jet-woo-builder.php' ) 
             && is_plugin_active( 'woocommerce/woocommerce.php' )
             && is_plugin_active( 'elementor/elementor.php' )  ) {
            add_submenu_page(
                'admin.php?page=jet-dashboard-settings-page',
                'ووکامرس ساز',
                'ووکامرس ساز',
                'manage_options',
                'edit.php?post_type=jet-woo-builder',
            );        
        } 

    }
    add_action( 'admin_init', 'ES_menu', 99 );
}


