File: /home/slyfwmm/adspray/wp-content/themes/aivons-child/functions.php
<?php
// Exit if accessed directly
if (!defined('ABSPATH')) exit;
/**
* Setup My Child Theme's textdomain.
*
* Declare textdomain for this child theme.
* Translations can be filed in the /languages/ directory.
*/
function aivons_child_theme_setup()
{
load_child_theme_textdomain('aivons-child', get_stylesheet_directory() . '/languages');
}
add_action('after_setup_theme', 'aivons_child_theme_setup');
if (!function_exists('aivons_child_thm_parent_css')) :
function aivons_child_thm_parent_css()
{
$ADS_file_js = get_stylesheet_directory() . '/assets/js/ADS_script.js';
$ADS_ver_js = filemtime( $ADS_file_js );
$ADS_file_style_css = get_stylesheet_directory() . "/assets/css/ADS_style.css";
$ADS_ver_style_css = filemtime($ADS_file_style_css);
$ADS_file_header_css = get_stylesheet_directory() . "/assets/css/ADS_style_header_no_elementor.css";
$ADS_ver_header_css = filemtime($ADS_file_header_css);
$ADS_file_footer_css = get_stylesheet_directory() . "/assets/css/ADS_style_footer_no_elementor.css";
$ADS_ver_footer_css = filemtime($ADS_file_footer_css);
$ADS_file_home_css = get_stylesheet_directory() . "/assets/css/ADS_home.css";
$ADS_ver_home_css = filemtime($ADS_file_home_css);
// loading parent styles
wp_enqueue_style('aivons-parent-style', get_template_directory_uri() . '/style.css', array('aivons-fonts', 'aivons-icons', 'bootstrap', 'fontawesome'));
// loading child style based on parent style
wp_enqueue_style('aivons-style', get_stylesheet_directory_uri() . '/style.css', array('aivons-parent-style'));
wp_enqueue_style('ADS-style', get_stylesheet_directory_uri() . "/assets/css/ADS_style.css", array('aivons-parent-style'),$ADS_ver_style_css,'all');
wp_enqueue_style('ADS-style-header-no-Elementor', get_stylesheet_directory_uri() . "/assets/css/ADS_style_header_no_elementor.css", array('aivons-parent-style'),$ADS_ver_header_css,'all');
wp_enqueue_style('ADS-style-footer-no-Elementor', get_stylesheet_directory_uri() . "/assets/css/ADS_style_footer_no_elementor.css", array('aivons-parent-style'),$ADS_ver_footer_css,'all');
if(is_page_template('ADS_home.php')) {
wp_enqueue_style('ADS-home', get_stylesheet_directory_uri() . "/assets/css/ADS_home.css", array('aivons-parent-style'),$ADS_ver_home_css,'all');
}
wp_enqueue_script('ADS', get_stylesheet_directory_uri() . '/assets/js/ADS_script.js', array(), $ADS_ver_js, true);
}
endif;
add_action('wp_enqueue_scripts', 'aivons_child_thm_parent_css');
// END ENQUEUE PARENT ACTION
/* LOAD CUSTOM CSS */
if( ! function_exists( 'custom_css' ) ) {
function custom_css() {
$fileCSS = get_stylesheet_directory_uri() . "/ADS_style.css";
$style_ver = filemtime( $fileCSS );
/* DEFINISCO UNA VARIABILE PER VERSIONARE IL FILE IN BASE ALLA DATA E L'ORA DEL SALVATAGGIO */
$version = filemtime( $themecsspath );
wp_enqueue_style( 'aivons-style', get_stylesheet_directory_uri()."/ADS_style.css", array(), /* VARIABILE DELLA VERSIONE */ $style_ver, /* media = */'screen');
}
}
add_action('wp_enqueue_scripts', 'custom_css', 999 /* CON QUESTO NUMERO SI DECIDE DOVE POSIZIONARE IL CSS */);