File: /home/zeusxp5/chuair.org/wp-content/themes/lifttruck/inc/enqueue-scripts.php
<?php
/**
* Enqueue all styles and scripts
*
* @package lifttruck
* @since lifttruck 1.0.0
*/
function lifttruck_load_js_css_file() {
$asset = include get_parent_theme_file_path( 'public/css/screen.asset.php' );
wp_enqueue_style( 'lifttruck-style', get_parent_theme_file_uri( 'public/css/screen.css' ), $asset['dependencies'], $asset['version'] );
if (is_singular() && get_option('thread_comments'))
wp_enqueue_script('comment-reply');
$script_asset = include get_parent_theme_file_path( 'public/js/screen.asset.php' );
wp_enqueue_script( 'mrbleo-screen', get_parent_theme_file_uri( 'public/js/screen.js' ), $script_asset['dependencies'], $script_asset['version'], true );
global $post, $wpdb;
if ( is_page() and has_shortcode($post->post_content, 'wdmp_maps') ) {
$lifttruck_protocol = is_ssl() ? 'https' : 'http';
$google_key_map = lifttruck_get_option('google_key_map');
if ($google_key_map != ""){
wp_enqueue_script('googlemapskey', $lifttruck_protocol."://maps.googleapis.com/maps/api/js?key=" . $google_key_map . "", array('jquery'), '4.4.2', false);
}
}
// localize the Filter Models script with new data
$wnm_custom = array('template_url' => admin_url( 'admin-ajax.php' ));
wp_localize_script('wd-script', 'urltheme', $wnm_custom);
}
add_action('wp_enqueue_scripts', 'lifttruck_load_js_css_file');
function lifttruck_editor_styles() {
add_editor_style( [ get_parent_theme_file_uri( 'public/css/screen.css' ) ] );
}
add_action( 'after_setup_theme', 'lifttruck_editor_styles' );
function lifttruck_editor_assets() {
$script_asset = include get_parent_theme_file_path( 'public/js/editor.asset.php' );
$style_asset = include get_parent_theme_file_path( 'public/css/editor.asset.php' );
wp_enqueue_script( 'mrbleo-editor', get_parent_theme_file_uri( 'public/js/editor.js' ), $script_asset['dependencies'], $script_asset['version'], true );
wp_enqueue_style( 'lifttruck-editor', get_parent_theme_file_uri( 'public/css/editor.css' ), $style_asset['dependencies'], $style_asset['version'] );
$current_screen = get_current_screen();
if($current_screen->post_type == 'page') {
$script_metabox_fields = include get_parent_theme_file_path( 'public/js/metabox-fields.asset.php' );
wp_enqueue_script( 'metabox-fields', get_parent_theme_file_uri( 'public/js/metabox-fields.js' ), $script_metabox_fields['dependencies'], $script_metabox_fields['version'], true );
}
}
add_action( 'enqueue_block_editor_assets', 'lifttruck_editor_assets' );