<?php
/*
Plugin Name: Goyto Plugin
Plugin URI: https://themeforest.net/user/themexriver
Description: After install the goyto WordPress Theme, you must need to install this "goyto-plugin" first to get all functions of goyto WP Theme.
Author: Raziul Islam
Author URI: http://themexriver.com/
Version: 1.0.7
Text Domain: goyto-plugin
*/
if ( !defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

/**
 * Define Core Path
 */
define( 'GOYTO_VERSION', '1.0.2' );
define( 'GOYTO_DIR_PATH',plugin_dir_path(__FILE__) );
define( 'GOYTO_DIR_URL',plugin_dir_url(__FILE__) );
define( 'GOYTO_INC_PATH', GOYTO_DIR_PATH . '/inc' );
define( 'GOYTO_PLUGIN_IMG_PATH', GOYTO_DIR_URL . '/assets/img' );


/**
 * Load plugin textdomain.
 */
function goyto_load_textdomain() {
    load_plugin_textdomain( 'goyto-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}

add_action( 'init', 'goyto_load_textdomain' );
/**
 * Css Framework Load
 */
if ( file_exists(GOYTO_DIR_PATH.'/lib/codestar-framework/codestar-framework.php') ) {
    require_once  GOYTO_DIR_PATH.'/lib/codestar-framework/codestar-framework.php';
}

/**
 *  Elementor - Remove Font Awesome
 */
add_action( 'elementor/frontend/after_register_styles',function() {
    foreach( [ 'solid', 'regular', 'brands' ] as $style ) {
      wp_deregister_style( 'elementor-icons-fa-' . $style );
    }
  }, 20 );


/**
 * Register Custom Widget
 *
 * @return void
 */
function goyto_cw_wisget(){
    register_widget( 'goyto_Recent_Posts' );
}
add_action('widgets_init', 'goyto_cw_wisget');


/**
 * Deregister Elementor Animation
 *
 * @return void
 */
function goyto_de_reg() {
    wp_deregister_style( 'e-animations' );
}
add_action( 'wp_enqueue_scripts', 'goyto_de_reg' );

/**
 * Enqueue Admin Style
 *
 * @return void
 */
function goyto_enqueue_admin_customstyle() {
    wp_enqueue_style( 'admin-style', GOYTO_DIR_URL . '/assets/css/admin-style.css', false, '1.0.0' );
}
add_action( 'admin_enqueue_scripts', 'goyto_enqueue_admin_customstyle' );

/**
 * Enqueue Admin Style
 *
 * @return void
 */
function goyto_enqueue_front_customstyle() {
    wp_enqueue_style( 'aw-flaticon', GOYTO_DIR_URL . '/assets/css/flaticon.css', false, '1.0.0' );
}
add_action( 'wp_enqueue_scripts', 'goyto_enqueue_front_customstyle' );

/**
 * Dequeue Elemenotr Swiper Slider
 *
 * @return  [type]  [return description]
 */
function dequeue_wpml_styles(){
    wp_dequeue_style( 'swiper' );
    wp_deregister_style( 'swiper' );

    wp_dequeue_script( 'swiper' );
    wp_deregister_script( 'swiper' );
}
add_action( 'wp_enqueue_scripts', 'dequeue_wpml_styles', 20 );


/**
 * Script Remove
 *
 * @return  [type]  [return description]
 */
function remove_jquery_sticky() {
		wp_dequeue_script( 'swiper' );
		wp_deregister_script( 'swiper' );
}
add_action( 'elementor/frontend/after_register_scripts', 'remove_jquery_sticky' );


/**
 * Custom Widget
 */
include_once GOYTO_INC_PATH . "/custom-widget/recent-post.php";

/**
 * Themeoption
 */
include_once GOYTO_INC_PATH . "/goyto-plugin-helper.php";

function goyto_plugin_setup(){
    /**
     * Custom Metabox
     */
    include_once GOYTO_INC_PATH . "/options/theme-metabox.php";

    /**
     * Themeoption
     */
    include_once GOYTO_INC_PATH . "/options/theme-option.php";
}
add_action( 'after_setup_theme', 'goyto_plugin_setup' );


/**
 * Helper Function
 */
include_once GOYTO_INC_PATH . "/helper.php";


/**
 * Codestar Custom Icon Liberary
 */
include_once GOYTO_INC_PATH . "/csf-custom-icon.php";
/**
 * Elementor Custom Icon
 */

include_once GOYTO_INC_PATH . "/constim-icon.php";

/**
 * Custom Template CPT
 */
include_once GOYTO_INC_PATH . "/post-type/template.php";



/**
 * Elementor Configuration
 */
include_once GOYTO_DIR_PATH . "/elementor/elementor-init.php";

/**
 * Contact Form 7 Autop Remove
 */
add_filter('wpcf7_autop_or_not', '__return_false');