Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Enqueue and clean up scripts and styles
- */
- function fix_styles_and_scripts() {
- if ( is_singular( 'documentation' ) ) {
- wp_enqueue_script( 'prism', get_stylesheet_directory_uri() . '/js/prism.js', array(), '2.8', true );
- }
- wp_deregister_style( 'font-awesome' ); // This is now handled by the official Font Awesome plugin
- // Clean up uneeded styles
- if ( ! is_admin() && ! \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
- wp_deregister_style( 'elementor-icons' );
- wp_deregister_style( 'elementor-icons-shared-0' );
- wp_deregister_style( 'elementor-icons-fa-regular' );
- }
- wp_deregister_style( 'astra-theme-css' );
- wp_deregister_style( 'astra-menu-animation' );
- wp_deregister_style( 'wp-block-library' );
- wp_deregister_style( 'wp-block-library-theme' );
- wp_deregister_style( 'edd-changelog' );
- wp_deregister_style( 'genericons' ); // Icons for EDD changelog
- wp_deregister_style( 'edd-recurring' );
- // Scripts
- wp_dequeue_script( 'astra-flexibility' );
- wp_dequeue_script( 'astra-customevent' );
- wp_dequeue_script( 'astra-theme-js' );
- wp_dequeue_script( 'wp-seopress-gutenberg-faq-block' );
- wp_dequeue_script( 'edd-jilt-subscribe-form' );
- wp_dequeue_script( 'jquery-block-ui' ); // Jilt
- wp_dequeue_script( 'wp-embed' );
- wp_dequeue_script( 'elementor-sticky' );
- wp_dequeue_script( 'elementor-waypoints' );
- wp_dequeue_script( 'jquery-migrate' );
- if ( ! is_page( 'affiliate-area' ) && ! is_page( 'affiliate-registration' ) ) {
- wp_deregister_style( 'affwp-forms' );
- }
- if ( false === strpos( $_SERVER['REQUEST_URI'], 'checkout' ) && false === strpos( $_SERVER['REQUEST_URI'], 'account' ) ) {
- wp_deregister_style( 'astra-edd' );
- wp_deregister_style( 'edd-styles' );
- wp_dequeue_script( 'edd-stripe-js' );
- wp_dequeue_script( 'edd-ajax' );
- wp_dequeue_script( 'edd-jilt' );
- wp_dequeue_script( 'edd-frontend-recurring' );
- }
- if ( false === strpos( $_SERVER['REQUEST_URI'], 'feature-requests' ) && ! is_page( 'roadmap' ) ) {
- wp_deregister_style( 'jck-sfr-main' );
- wp_dequeue_script( 'jck-sfr-main' );
- }
- if ( ! is_page( 'documentation' ) && ! is_search() ) {
- wp_deregister_style( 'searchwp-live-search' );
- wp_dequeue_script( 'swp-live-search-client' );
- }
- if ( ! is_page( 'pricing' ) && ! is_single( 'crm-compatibility-table' ) ) {
- wp_deregister_style( 'tablepress-default' );
- }
- if ( ! is_singular( 'documentation' ) ) {
- wp_deregister_style( 'helpful-theme-base' );
- wp_dequeue_script( 'helpful' );
- }
- if ( ! is_singular( 'post' ) && ! is_singular( 'cpt_feature_requests' ) ) {
- wp_dequeue_script( 'comment-reply' );
- }
- global $wp_styles;
- unset( $wp_styles->registered['elementor-frontend']->extra['after'] );
- // Move the Astra custom stuff to the child theme and save one request
- // $wp_styles->registered['astra-child-theme-css']->extra['after'] = $wp_styles->registered['astra-theme-css']->extra['after'];
- }
- add_action( 'wp_enqueue_scripts', 'fix_styles_and_scripts', PHP_INT_MAX ); // has to be be PHP_INT_MAX because Helpful enqueues their styles at that priority
- function child_enqueue_styles() {
- wp_enqueue_style( 'astra-child-theme-css', get_stylesheet_directory_uri() . '/style.css', array(), '1.0.65', 'all' );
- wp_enqueue_style( 'prism', get_stylesheet_directory_uri() . '/prism.css', array(), '1.0.2', 'all' );
- // Load the font sizes and colors early to avoid the flash of styling.
- $data = '*{border:0;font-size:100%;font-style:inherit;font-weight:inherit;margin:0;outline:0;padding:0}html>body{font-family:Sans-serif;-webkit-font-smoothing:antialiased;overflow-x:hidden;line-height:1.8;font-size:18px;color:#737f90}:not( h1,h2,h3,h4,h5,h6,.blob-code,pre ){font-family:"Lota Grotesque",Sans-serif}h1,h1>span,h2,h3,h4,h5,h6{font-family:Geomanist,Sans-serif;color:#000;font-weight:600;line-height:1.15}.h1,h1{font-size:3rem}.h2,h2{margin:30px 0 10px;font-size:1.66rem}.h3,h3{margin:30px 0 10px;font-size:1.5rem}.h4,h4{margin:40px 0 10px;font-size:1.25rem}h1.elementor-heading-title{font-size:64px}.fa,.far,.fas{font-family:"Font Awesome 5 Free";font-weight:900}@media (max-width:767px){body{background-image:none!important}svg#blue-blob-bg{display:none}h1.elementor-heading-title,h2.elementor-heading-title{font-size:48px!important;line-height:1.15!important}}body.single-documentation h1.elementor-heading-title{font-size:48px}.entry-content p,p{margin-bottom:.89em}img{vertical-align:middle;height:auto;max-width:100%}a{color:#0b328e}table{border-spacing:0}body b,body strong{color:#333;font-weight:600}body a>b,body a>strong{color:#0b328e}@media (min-width:767px){.elementor-nav-menu li.menu-item-has-children{padding-right:22px!important}}.elementor-nav-menu .sub-arrow{position:absolute;right:0;display:none}ul.elementor-nav-menu li.menu-item.menu-item-has-children:after{font-family:"Font Awesome 5 Free";font-weight:900;display:inline-block;content:"\f0d7";position:absolute;right:20px;top:50%;margin-top:-8px;color:#000;border:none}.elementor-16596 ul.elementor-nav-menu li.menu-item.menu-item-has-children:after,.elementor-18192 ul.elementor-nav-menu li.menu-item.menu-item-has-children:after{color:#fff}';
- wp_add_inline_style( 'astra-child-theme-css', $data );
- // wp_enqueue_script( 'anchoring', get_stylesheet_directory_uri() . '/js/jquery.anchoring.js', array( 'jquery' ), '2.8', true );
- // The main .js file
- $ver = '2.8.7';
- if ( current_user_can( 'manage_options' ) ) {
- $ver = time();
- }
- wp_enqueue_script( 'wpfmain', get_stylesheet_directory_uri() . '/js/main.js', array( 'jquery' ), $ver, true );
- wp_localize_script( 'wpfmain', 'wpfmain', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
- }
- add_action( 'wp_enqueue_scripts', 'child_enqueue_styles', 5 ); // on 5 so there isn't a flash.
- add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );
- // Set fonts to font-display: swap; to prevent flash
- add_filter(
- 'elementor_pro/custom_fonts/font_display',
- function( $current_value, $font_family, $data ) {
- return 'swap';
- },
- 10,
- 3
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement