dudaster / ele-custom-skin

Create a skin for Elementor Pro Post and Post Archive widgets using Elementor templates
GNU General Public License v3.0
59 stars 10 forks source link

PHP Fatal error: if Elementor Pro is not enable #350

Open pako69 opened 3 years ago

pako69 commented 3 years ago

Hi

In all the pages of our website I use a specific plugin (https://fr.wordpress.org/plugins/plugin-organizer/) to disable not required plugins : It make my page load faster.

On some pages I do not need Elementor Pro, but just Elementor Free. On some pages I do not need Elementor at all.

But the issue is I get this fatal error when I access to a page where Elementor Pro has been disabled:

[25-Sep-2020 16:03:45 UTC] PHP Fatal error:  Uncaught Error: Class 'ElementorPro\Modules\Posts\Skins\Skin_Base' not found in /home/sandbox/mysite.com/wp-content/plugins/ele-custom-skin/skins/skin-custom.php:16
Stack trace:
#0 /home/sandbox/mysite.com/wp-content/plugins/ele-custom-skin/ele-custom-skin.php(43): require_once()
#1 /home/sandbox/mysite.com/wp-includes/class-wp-hook.php(287): elecs_add_skins(Object(Elementor\Widgets_Manager))
#2 /home/sandbox/mysite.com/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
#3 /home/sandbox/mysite.com/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#4 /home/sandbox/mysite.com/wp-content/plugins/elementor/includes/managers/widgets.php(99): do_action('elementor/widge...', Object(Elementor\Widgets_Manager))
#5 /home/sandbox/mysite.com/wp-content/plugins/elementor/includes/managers/widgets.php(235): Elementor\W in /home/sandbox/mysite.com/wp-content/plugins/ele-custom-skin/skins/skin-custom.php on line 16

Could you please:

The first option should be the best.

Thanks

dudaster commented 3 years ago

Update elementor first and then ECS and will solve the issue

pako69 commented 3 years ago

Humm... I do not understand your answer or you do not understand my issue... ^^

I asked you if it's possible to load alll your plugins assest (JS/CSS) ONLY if the Elementor Pro Widget is used in a page.

It's a best practice for all developpers to selectively load their assets only if they are used. It's a question of website performance, and performance is an SEO point ;-)

Thanks

dudaster commented 3 years ago

This plugin is a skin for posts widgets which is only in elementor pro. Also it uses the dynamic values that only elementor pro has.

pako69 commented 3 years ago

Yes I know :-)

And as I said, I unload Elementor Pro on some pages (to get more speed) but when Elementor Pro is disabled your plugin make a Fatal Error because it's looking for include some stuff of Elementor Pro.

So my question stay the same: Is it possible to load all your plugins assest (JS/CSS) ONLY if the Elementor Pro Widget is used in a page OR oly if Elementor Pro is activated in a page.

-- https://developers.elementor.com/creating-an-extension-for-elementor/ https://gist.github.com/ramiy/62c34ffa30fcafbfd279b1a77b4dfeb2

dudaster commented 3 years ago

How do you accomplish this? To unload the E Pro I mean.

pako69 commented 3 years ago

as I also said first ^^ : I use a specific plugin (https://fr.wordpress.org/plugins/plugin-organizer/)

dudaster commented 3 years ago

But you don’t want to disable the ECS for its assets. I understood right?

pako69 commented 3 years ago

I don't want ECS to try to make a require_once() of Elementor Pro stuff 'ElementorPro\Modules\Posts\Skins\Skin_Base' IF Elementor Pro is not used in a page. That way ECS will no throw a PTP fatal error.

Something like:

if (Elementor_Pro = TRUE) {
load ECS;
} {
//Do nothing
}

PS/ I'm not English to I do my best for you to understand me ;-

dudaster commented 3 years ago

Thanks for the tip!