Slow wordpress performance
-
[Moderator note: Please don’t uppercase your sentences]
My WordPress site is incredibly slow. ySlow gives it a D rating. I have installed W3 Total Cache, but it’s not helping.
The theme is a custom theme built by another company. In the the theme.php file (which is called by functions.php), there’s a ton of JavaScript and CSS files being enqueued. I want to move these to the footer to try to speed up the site. I’ve tried the following, for example:
wp_enqueue_script( 'interactive-main', $this->dir . '/__inc/interactive/js/main.js' , array( 'jquery' ), null, true );But it seems to have no effect. The file still gets loaded into the head section.
The full function is here:
public function load_scripts_and_styles(){ global $post ; if ( is_object( $post ) ){ switch( $post->ID ){ case 6 : // 'Our Technology' case 55 : // 'Specific Solutions case 47 : // 'The Platform case 69 : // How we work $this->enqueueInteractiveSection(); } } $this->enqueueFormElements(); $this->enqueue_touchcarousel(); wp_register_style('reset', $this->dir .'/__inc/css/reset.css' ); wp_register_style('base', $this->dir .'/__inc/css/base.css' ); wp_register_style('main', $this->dir .'/style.css', array( 'reset', 'base' ) ); wp_register_style('landing-page', $this->dir .'/css/landing-page.css' ); wp_register_style('executive-landing', $this->dir .'/css/executive-landing.css' ); wp_enqueue_style( 'bootstrap' , $this->dir .'/__inc/bootstrap/css/bootstrap.min.css' ) ; wp_enqueue_style( 'landing-page' ); wp_enqueue_style( 'executive-landing' ); wp_enqueue_style( 'main' ); wp_enqueue_style( 'media-queries', $this->dir .'/css/media-queries.css' ); wp_enqueue_script( 'modernizr', $this->dir . '/__inc/modernizr.custom.81510.js' ); wp_enqueue_script( 'hashchange', $this->dir .'/__inc/jquery.ba-hashchange.min.js', array( 'jquery' ) ); wp_enqueue_script( 'throttle-debounce' , $this->dir .'/__inc/jquery.ba-throttle-debounce.min.js', array( 'jquery' ) ); wp_enqueue_script( 'resize' , $this->dir .'/__inc/resizeActions.jquery.js', array( 'jquery', 'throttle-debounce' ) ); wp_enqueue_script( 'imagesLoaded', $this->dir .'/__inc/imagesLoaded/imagesloaded.pkgd.min.js', array( 'jquery' ) ); wp_enqueue_script( 'scrollTo', $this->dir .'/__inc/jquery.scrollTo.min.js', array( 'jquery') ); wp_enqueue_script( 'isotope', $this->dir .'/__inc/jquery.isotope.min.js', array( 'jquery' ) ); wp_enqueue_script( 'll_tabs', $this->dir .'/__inc/jquery.ll_tabs.js', array( 'jquery' ) ); wp_enqueue_script( 'simpleHistory', $this->dir .'/__inc/simple-history.js', array( 'jquery' ) ); wp_enqueue_script( 'landing-page', $this->dir .'/js/landing-page.js' ); wp_enqueue_script( 'main', $this->dir.'/js/main.js', array( 'jquery', 'modernizr', 'imagesLoaded', 'resize', 'isotope', 'scrollTo', 'll_tabs', 'simpleHistory', 'hashchange' ) ); wp_localize_script( 'main', 'wp_vars' , array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'theme_dir' => $this->dir, 'url' => get_bloginfo( 'url' ), 'page_siblings' => get_current_page_siblings() ) ); } protected function enqueue_touchcarousel(){ //wp_enqueue_style( 'touchcarousel', $this->dir .'/__inc/touchcarousel/touchcarousel.css' ); wp_enqueue_script( 'touchcarousel', $this->dir .'/__inc/touchcarousel/jquery.touchcarousel-1.2.min.js', array( 'jquery' )); }Any help would be great!
The topic ‘Slow wordpress performance’ is closed to new replies.