/
www
/
wwwroot
/
fxdst.com
/
wp-content
/
themes
/
fxdst
/
inc
/
Upload File
HOME
<?php /* * @Theme Name:WebStack * @Theme URI:https://www.iotheme.cn/ * @Author: iowen * @Author URI: https://www.iowen.cn/ * @Date: 2020-02-22 21:26:05 * @LastEditors: iowen * @LastEditTime: 2023-02-20 20:56:55 * @FilePath: \WebStack\inc\register.php * @Description: */ if ( ! defined( 'ABSPATH' ) ) { exit; } define( 'THEME_URL', get_bloginfo('template_directory') ); function theme_load_scripts() { $theme_version = esc_attr(wp_get_theme()->get('Version')); $fxdst_style_version = file_exists(get_theme_file_path('/style.css')) ? filemtime(get_theme_file_path('/style.css')) : $theme_version; wp_register_style( 'font-awesome', THEME_URL.'/css/font-awesome.min.css', array(), $theme_version, 'all' ); wp_register_style( 'bootstrap', THEME_URL.'/css/bootstrap.css', array(), $theme_version, 'all' ); wp_register_style( 'nav', THEME_URL.'/css/nav.css', array(), $theme_version ); wp_register_style( 'fxdst-style', THEME_URL.'/style.css', array('nav'), $fxdst_style_version ); $fxdst_sites_detail_version = file_exists(get_theme_file_path('/css/sites-detail.css')) ? filemtime(get_theme_file_path('/css/sites-detail.css')) : $theme_version; wp_register_style( 'fxdst-sites-detail', THEME_URL.'/css/sites-detail.css', array('fxdst-style'), $fxdst_sites_detail_version ); wp_register_script( 'bootstrap', THEME_URL.'/js/bootstrap.min.js', array('jquery'), $theme_version, true ); wp_register_script( 'TweenMax', THEME_URL.'/js/TweenMax.min.js', array('jquery'), $theme_version, true ); wp_register_script( 'appjs', THEME_URL.'/js/app.js', array('jquery'), $theme_version, true ); wp_register_script( 'lazyload', THEME_URL.'/js/lazyload.min.js', array('jquery'), $theme_version, true ); if( !is_admin() ) { wp_enqueue_style('font-awesome'); wp_add_inline_style('font-awesome', "@font-face{font-family:'FontAwesome';src:url('" . THEME_URL . "/fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('" . THEME_URL . "/fonts/fontawesome-webfont.woff?v=4.7.0') format('woff');font-weight:normal;font-style:normal;font-display:swap}"); wp_enqueue_style('bootstrap'); wp_enqueue_style('nav'); wp_enqueue_style('fxdst-style'); if ( is_singular('sites') ) { wp_enqueue_style('fxdst-sites-detail'); } wp_deregister_script( 'jquery' ); // Keep jQuery out of the critical rendering path. The contribution form // still contains legacy inline handlers, so retain head loading there. $jquery_in_footer = ! is_page_template('template-contribute.php'); wp_register_script( 'jquery', THEME_URL.'/js/jquery-1.11.1.min.js', array(), $theme_version, $jquery_in_footer ); wp_enqueue_script('jquery'); wp_enqueue_script('bootstrap'); $fxdst_is_directory_landing = is_home() || is_front_page() || (function_exists('fxdst_en_request') && fxdst_en_request()) || (function_exists('fxdst_rank_is_request') && fxdst_rank_is_request()); if ( ! $fxdst_is_directory_landing ) { wp_enqueue_script('TweenMax'); } wp_enqueue_script('appjs'); if(io_get_option('lazyload')) wp_enqueue_script('lazyload'); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } wp_localize_script('appjs', 'theme' , array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'addico' => get_theme_file_uri('/images/add.png'), 'version' => $theme_version, )); } add_action('wp_enqueue_scripts', 'theme_load_scripts');