Looking at a malfunction with Events Calendar on the site of Joshua, I realized a fact that may affect many of you.
Joshua told me access to the site because the display in the large calendar is not correct. Indeed, navigation month to month is impossible, the events created are not displayed and of course no tooltips associated.
After downloading the site on my computer I could make all the tests that I wanted. And it’s this that I realized that it was still a problem of conflict between plugins. But here I could put my finger on the heart of the problem.
What is it?
The problem is the method of loading these libraries by these plugins and the theme.
What is the right method?
Normally, in accordance with the procedures with Wordpress, and are respected by Event Calendar I want to say it, loading a library by a plugin must follow simple rules:
- The code should be indicated in a function that is dedicated loading and conflict management. For example, to the library ‘bgiframe’:
wp_enqueue_script('jquerybgiframe', '/wp-content/plugins/events-calendar/js/jquery.bgiframe.js', array('jquery'), '2.1');
wp_enqueue_script: the name of the function that will place the code loading XHTML.
jquerybgiframe: the name of the library which will verify that the file has not already been asked by another player.
/wp-content/plugins/events-calendar/js/jquery.bgiframe.js: the path and file name
array ( ‘jquery’): category Bibliothèque
and 2.1: the version of the code
All these functions for each of libraries plugin is necessary wrapped in a function.
For example, with Events-Calendar, it’s: EventsCalendarINIT().
This function will be called by another function provided in Wordpress: add_action().
So we will:
add_action ( 'plugins_loaded', 'EventsCalendarINIT');
Where ‘plugins_loaded‘ is the event (the hook) that will trigger the execution of the function. It is even possible as the third parameter to indicate the order of priority, with 10 default: $priority = 10.
What is the problem?
The problem is that plugins ‘Flikr-tag’, ‘Wp-forum’ and the theme ‘Aspire’, they carry their scripts in other ways, rather ‘old’. For instance in Flikr-tag we have (this is a part of the function):
It is direct and brutal, regardless of cohabitation with other plugins.
Moreover, the loading of the function by Wordpress is through the event ‘wp-head’:
add_action('wp_head', array($this, "getPublicHead"));
Ie that the loading scripts will be made in the header, apart from all management of conflicts.
What should we do?
Should Joshua must find a person who will work to understand and modify the fault plugins code? This would involve freezing these plugins in time, without benefit of future versions, but without benefit of changes to adapt to changes in Wordpress itself. Joshua might be obliged to keep its current versions of Wordpress.
Should we contact the creators of these plugins and this theme, and wait patiently for our demand is taken into account and they please respond? Knowing that the editor Flikr-tag is Yahoo, it may take a long time! And I think I have that Wp-forum is very well followed. In the pages of the directory that references these plugins you can see, in addition, it has not been tested with the latest version of Wordpress.
Should we abandon these plugins and this theme to find alternatives? I dare not propose to Joshua!
Should it adapt Events-Calendar to reflect the shortcomings of other plugins and theme Aspire? I really do not see how. Unless you fall into the draft, and the dish of spaghetti!
Maybe I do not see things and I am wrong?
Perhaps one of you has another idea I submit?
Help me, I do not know what to say to Joshua!