onOffice-Web-Org / oo-wp-plugin

onOffice for WP-Websites
https://wp-plugin.onoffice.com
GNU General Public License v3.0
9 stars 9 forks source link

WP Script Dequeue function #737

Closed fredericalpers closed 7 months ago

fredericalpers commented 8 months ago

Initiative

Enhance script management in the onOffice for WP-Websites plugin.

Epic

Implement advanced script dequeuing action

User story

The recent update to onOffice plugin version 4.15 has introduced challenges related to script management, particularly with regards to dequeuing and deregistering scripts.

https://developer.wordpress.org/reference/functions/wp_dequeue_script/ https://developer.wordpress.org/reference/functions/wp_dequeue_style/

Despite attempting to dequeue scrips in the functions.php file, the changes are ineffective as the scripts are loaded after the deqeues are executed. To address this issue, I require the implementation of a new action that allows me to continue dequeueing scripts. Additionaly, the priority of dequeues should be adjusted.

Tasks

The implementation will address the script management issues faced by users after updating to onOffice plugin version 4.15. By providing a new action for script dequeuing, along with an adjusted priority, users will have enhanced control over script loading and management, leading to improved websites performance and functionality.

dai-eastgate commented 8 months ago

@fredericalpers Yes, I know this problem: In version 4.15 we have implemented "Only load required scripts and CSS" #610 we use "wp_register_script" and "wp_enqueue_script" in namefile.php specifically in the "root-plugin/plugin" folder. => Despite your attempting to dequeue scrips in the functions.php file, the changes are ineffective as the scripts are loaded after the dequeues are executed.

But if I implement "Develop and integrate a new action that enables script dequeuing" feature, I am afraid it will be difficult for us to ensure "Only load required scripts and CSS" I need one more day to try implementing it, and then will accurately inform you about the feasibility of this task or the most optimal solution.

dai-eastgate commented 8 months ago

@fredericalpers We have found the only and most optimal solution to ensure:

We tried to implement it at this branch https://github.com/onOffice-Web-Org/oo-wp-plugin/tree/wp-script-dequeue-function you can test it and review the code.

This is a video demo:

https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/106214469/9a6ca0cb-d8af-415f-8a32-0b893728ec65

Please watch the video and let me know your opinions. Thanks!

fredericalpers commented 8 months ago

@dai-eastgate it seems to be working fine this way. We will review it asap, thank you :)

dai-eastgate commented 8 months ago

@fredericalpers I created a PR (https://github.com/onOffice-Web-Org/oo-wp-plugin/pull/741) for the issues.

  • Use "shortcode embedded" in page content (ex:[oo_estate view="Estate List"]) to detect page type (estate list, detail, forms, unit list,..)

image

Note: As mentioned above we have implemented a solution. Pls, review carefully this solutions again? then response your opinion for me. thanks