Code Monkey home page Code Monkey logo

speed-up-elementor's Introduction

Speed Up Elementor

Simple snippet to manage JS, CSS and others to improve Elementor performance. Include WordPress improvements too.

Note: I will create a free plugin for WordPress directory with more options soon!

How to use

You can create a simple plugin for WordPress with code or paste in functions.php in your theme.

For example in this snippet i used is_front_page for add all optimizations in your front page (home). You can edit all functions to add in other pages, or create others functions to add dynamic options for each page (recomended).

Specific in functions remove_elementor_pro_js and remove_elementor_js comment or remove dependences for dont load this JS, like:

public function remove_elementor_js () {

	if ( is_front_page() ) {

		wp_deregister_script( 'elementor-frontend' );

		wp_register_script(
        	'elementor-frontend',
        	ELEMENTOR_ASSETS_URL . 'js/frontend.min.js',
        	[
          	'elementor-frontend-modules',
          	//'elementor-dialog', //Just comment if you want dont load this JS in page
          	'elementor-waypoints',
          	'swiper',
          	'share-link',
        	],
        	ELEMENTOR_VERSION,
        	true
		);
	}
}

Improtant: When you remove CSS and JS by Elementor you need understand if its required or not for your page. If you remove required script your page ir broke. Test each optimizations and check what you can remove.

speed-up-elementor's People

Contributors

eduardovillao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

speed-up-elementor's Issues

First loop does not load a dynamic ACF mask correctly

I encounter a problem with loop widgets (Grid or Carousel).
In my loop I use the CTA widget with a global mask on the widget, this mask comes from an image loaded from an ACF field.
The first loop does not display correctly, the following ones without problem.
Looking at the code I see that the CSS rule of the mask, on the first loop, is overwritten by a generic mask rule:
.elementor-2341 .elementor-element.elementor-element-f4b3b26:not(.elementor-widget-image) .elementor-widget-container {
-webkit-mask-image: url(http://gizyors.cluster023.hosting.ovh.net/wp-content/plugins/elementor/assets//mask-shapes/custom.svg);
-webkit-mask-size: contain;
-webkit-mask-position: center center;
-webkit-mask-repeat: no-repeat;
}

While my CSS rule is loaded BEFORE:
.e-loop-item-29 .elementor-element.elementor-element-f4b3b26:not(.elementor-widget-image) .elementor-widget-container {
-webkit-mask-image: url(http://gizyors.cluster023.hosting.ovh.net/wp-content/uploads/2024/05/logo-blomus-detour.svg);
}

On the following loops the order of the rules is reversed and the mask is clearly displayed.

I made a video to show the problem here: https://go.screenpal.com/watch/cZhtQwVLsVx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.