• Resolved shorif2000

    (@shorif2000)


    i am using google page speed to check problems on the site and it is reporting styles.css as not being minified how can i include this with the rest

    View post on imgur.com

    my code in the child themes function files is as foolows for enquing scripts and css.

    add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
    function enqueue_child_theme_styles() {
    
    	//wp_enqueue_script( 'modernizr', get_stylesheet_directory_uri() . '/js/modernizr-2.8.3.min.js', array(), '2.8.3' ); 
    
    	if(is_ie() && get_browser_version() < 8){
    		wp_dequeue_style( "ubermenu" );
    		wp_dequeue_style( "ubermenu-font-awesome" );
    		wp_dequeue_style( "ubermenu-custom-stylesheet" );
    		wp_dequeue_script("ubermenu");
    		wp_dequeue_script("ubermenu-min");
    		wp_dequeue_script("ubermenu-custom");
    
    	} 
    
    	if( ( (!is_ie()) || is_ie() && get_browser_version() > 8 ) ){
    		wp_enqueue_script( 'json2'); // required by recent.js for JSON. ie8
        	wp_enqueue_script( 'prototype_recent', get_stylesheet_directory_uri() . '/js/prototype.js', array(), '1.7.2', true ); // required by recent.js for JSON
    	}
    
        if( !is_front_page() && !is_page('interactive-map') && !is_page('contact-us') && !is_tree(6822) && !is_tree(6765) && !is_tree(6755) && !is_search() && !is_404() && ( (!is_ie()) || is_ie() && get_browser_version() > 8 ) )
        	wp_enqueue_script( 'recent_pages', get_stylesheet_directory_uri() . '/js/recent_pages.js' );
    
        wp_enqueue_script('jquery-ui-accordion');
        $data = array('site_url' => __(site_url()));
        wp_localize_script('custom', 'php_data', $data);
        wp_enqueue_script( 'custom', get_stylesheet_directory_uri() . '/js/custom.js', array('jquery'), '1', true );
    	if(is_front_page()){
       		//wp_enqueue_script( 'cvi_map_lib', get_template_directory_uri() . '-child/mapper/cvi_map_lib.js');
       		//wp_enqueue_script( 'cvi_tip_lib', get_template_directory_uri() . '-child/mapper/cvi_tip_lib.js');
       		//wp_enqueue_script( 'wz_jsgraphics', get_template_directory_uri() . '-child/js/wz_jsgraphics.js');
       		//wp_enqueue_script( 'maputil', get_template_directory_uri() . '-child/mapper/maputil.js');
       		wp_enqueue_script( 'mapper', get_stylesheet_directory_uri() . '/js/mapper/mapper.js', array(),'2.4' );
       		//wp_enqueue_script( 'tooltip', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' );
    	}
    	if(is_page('knowledge-map')){
    		wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyDYnZ9a2F5ihvsdHTghLZF4ZnGtWtiAW4A');
    		//http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble.js
    		wp_enqueue_script( 'infobubble', get_stylesheet_directory_uri() . '/js/infobubble.js');
    		//http://geoxml3.googlecode.com/svn/branches/polys/geoxml3.js
    		wp_enqueue_script( 'geoxml3', get_stylesheet_directory_uri() . '/js/geoxml3.js');
    		//http://geoxml3.googlecode.com/svn/trunk/ProjectedOverlay.js
    		wp_enqueue_script( 'ProjectedOverlay', get_stylesheet_directory_uri() . '/js/ProjectedOverlay.js');
    
    		wp_enqueue_script( 'knowledge_map', get_stylesheet_directory_uri() . '/js/knowledge_map.js');
    	}	
    
    	if(is_404() || is_search()){
    		wp_enqueue_script( 'gcse',  get_stylesheet_directory_uri() . '/js/gcse.js',array(),'');
    	}
    
    	wp_enqueue_script( 'jquery-cookie',  get_stylesheet_directory_uri() . '/js/jquery.cookie.js',array(),'1.4.1');
    }
    
    /* To disable in a child theme, use wp_dequeue_style()*/
    function mytheme_dequeue_fonts() {
    	wp_dequeue_style( 'twentytwelve-fonts' );
    }
    add_action( 'wp_enqueue_scripts', 'mytheme_dequeue_fonts', 11 );
    
    function wpse88755_enqueue(){
    	# call  wp_enqueue_style here
    	wp_enqueue_style( 'child-style-table', get_stylesheet_directory_uri() . '/css/table.css', array(  ) );
    }
    
    #hook the function to wp_enqueue_scripts
    add_action( 'wp_enqueue_scripts', 'wpse88755_enqueue' );
    
    //Second solution : two or more files.
    add_action( 'admin_enqueue_scripts', 'load_admin_styles' );
    function load_admin_styles() {
    	wp_enqueue_style( 'admin_style', get_stylesheet_directory_uri() . '/admin-style.css');
    }
    
    //add new from child theme
    wp_enqueue_style( 'twentytwelve_child-ie', get_stylesheet_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '1.0' );
    $wp_styles->add_data( 'twentytwelve_child-ie', 'conditional', 'lt IE 10' );

    https://wordpress.org/plugins/bwp-minify/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘themes style.css not being minified’ is closed to new replies.