Home › Forums › Calendar Products › Events Calendar PRO › Disable isotope library in photo view (upgrade-safe)
- This topic has 3 replies, 2 voices, and was last updated 12 years, 3 months ago by
Brook.
-
AuthorPosts
-
January 4, 2014 at 11:41 am #86893
indizio
ParticipantHey!
I want to disable the isotope library of the photo-view in my child theme. I made a quickfix in
wp-content/plugins/events-calendar-pro/resources/tribe-events-photo-view.js (Line 113) and changed the minified version accordingly:// tribe_setup_isotope($container);
$(‘#tribe-events-photo-events’).removeClass(“photo-hidden”).css(“opacity”, “1”);But after an update of the plugin the code will be gone of course.
I also tried dequeing the isotope script in child-theme/functions.php:
add_action(‘wp_print_scripts’,’example_dequeue_myscript’);
function example_dequeue_myscript() {
wp_dequeue_script( ‘tribe-events-pro-isotope’ );
wp_deregister_script( ‘tribe-events-pro-isotope’ );
}Thanks in advance for suggestions!
January 6, 2014 at 4:39 pm #87642Brook
ParticipantHowdy Indizo!
Your dequeue script should work perfectly. If you want to overwrite tribe-events-photo-view.js with your custom version I would just take your dequeue idea one step futher. Dequeue tribe-events-photo-view.js as well, then upload your custom version to your theme directory and enqeue it instead.
Does that make sense? Would that work for your situation?
– Brook
January 7, 2014 at 5:43 am #87757indizio
ParticipantHey Brook,
unfortunately dequeing does not work, because the photo-view is queued as dependent to the isotope file:
tribe-pro-template-factory.class.php
Line: 51
wp_enqueue_script( ‘tribe-events-pro-isotope’, $path1, array(‘tribe-events-pro’), null, true );
wp_enqueue_script(‘tribe-events-pro-photo’, $path2, array(‘tribe-events-pro-isotope’), null, true);So if I dequeue the isotope file, the tribe-events-pro-photo is also not loaded. Another option would be to detect (wp_script_is) if photo-view.js is loaded and then dequeue and enqueue everything again. But I think this would be a ugly hack in terms of performance, because I also have to localize the script then again.
So my (very) dirty hack by now is modifying $wp_scripts and remove the dependency: https://gist.github.com/anonymous/8299397
As a feature-suggestion:
Option in the backend for “Loading isotope js for photo view” and simply editing the load dependency in tribe-pro-template-factory.class.php accordingly to this option.Best regards,
MatthiasJanuary 8, 2014 at 12:17 pm #88743Brook
ParticipantMathias! I am sorry for this delayed response. There has been a hiccup on our end and I did not see your post.
I guess I was not clear in my recommendation. I was stating that you should should dequeue/deregister tribe-events-pro-photo as well, specifically because of its dependency. Once dequeued, enqueue your own custom version of tribe-events-photo.js without any dependencies. Ideally you would edit the custom js file to fully remove its isotope calls so you will not see any reference errors in the console. It sounds like you found an alternate method though.
I do appreciate the feature recommendation. We generally only implement an option if there are multiple users in need of it. I searched through our forums and so far you are the only one requesting it. I will definitely keep my ear to the ground to see if others are interested. If you would like to make an official feature recommendation, please add it to our uservoice page — which will allow future users to voice their support as well.
Thank you for posting your resolution. I really appreciate your contributions to our community. Let me know if I can assist you further. And again, sorry for the delay.
– Brook
-
AuthorPosts
- The topic ‘Disable isotope library in photo view (upgrade-safe)’ is closed to new replies.
