-
AuthorSearch Results
-
November 5, 2013 at 8:28 am #74761
In reply to: CSS replace like for Event calendar
Casey
ParticipantMastafu,
Unfortunately we don’t have a filter for that in Community events, but you should be able to do the following by dequeueing the Community styles and enqueueing your own styles. Just paste this code snippet into your theme’s functions.php file and it should get you started in the right direction: https://gist.github.com/ckpicker/7321714Let me know if that does the trick! Thanks!
October 3, 2013 at 10:50 am #69034In reply to: Theme Conflict
Barry
MemberHi insyte,
There are a few Javascript errors that would need to be resolved (one is that the Google Maps API is being loaded multiple times – perhaps your theme is also doing this if the problem goes away when you switch to a default theme)?
I don’t want to get into a game of pingball with your theme vendor, but would you be able to ask them for a snippet to disable (or to not enqueue/dequeue) their Google Maps related scripts on events pages? On our end we can certainly provide a conditional statement useful for detecting if the page is an events-oriented one or not, which looks like:
if ( tribe_is_event_query() ) { /* theme vendor snippet! */ }August 2, 2013 at 4:55 pm #58605In reply to: Unhooking styles & scripts
Kyle
ParticipantHi Michael,
I see you are wanting to unhook tribe-events.min.js .Since you are running pro, tribe-events-pro.min.js is being loaded, which has a dependency on tribe-events.min.js . In turn, tribe-events.min.js has dependencies on bootstrap-datepicker, ba-resize, and placeholder. tribe-events-bar.js also relies on these scripts.
To unhook the entire list of scripts you mentioned, you will need to either modify the script dependencies or unhook the scripts that have the dependencies as well.
For instance:
function dequeue_tribe_events_scripts_and_styles() {
wp_dequeue_script( 'tribe-events-pro-geoloc' );
wp_dequeue_script( 'tribe-events-list' );
wp_dequeue_script( 'tribe-events-pro' ); // relies on tribe-events-calendar-script
wp_dequeue_script( 'tribe-events-calendar-script' ); // relies on placeholder, resize, datepicker
wp_dequeue_script( 'tribe-events-bar' ); // relies on placeholder, resize, datepicker
wp_dequeue_script( 'tribe-events-bootstrap-datepicker' );
wp_dequeue_script( 'tribe-placeholder' );
wp_dequeue_script( 'tribe-events-jquery-resize' );
}
add_action('wp_enqueue_scripts', 'dequeue_tribe_events_scripts_and_styles', 100 );
Unhooking dependencies is a little tricker, but can be done with something like this:
function change_tribe_js_dependencies( $handle, $dep ) {
global $wp_scripts;if( in_array( $dep, $wp_scripts->registered[$handle]->deps ) ){
$key = array_search($dep, $wp_scripts->registered[$handle]->deps);
unset($wp_scripts->registered[$handle]->deps[$key]);
}return true;
}function remove_tribe_events_js_dependencies() {
change_tribe_js_dependencies(‘tribe-events-bar’,’tribe-events-calendar-script’);
}
add_action( ‘wp_enqueue_scripts’, ‘remove_tribe_events_js_dependencies’, 10 );That example removes the dependency on ‘tribe-events-calendar-script’ that ‘tribe-events-bar’ has. That means you can dequeue tribe-events-pro (tribe-events-pro.min.js), and tribe-events-calendar-script (tribe-events.min.js) but still load tribe-events-bar.min.js without it loading tribe-events.min.js
You can use this method if you want to load tribe-events-bar.min.js, but not, say, jquery.placeholder.min.js . Both tribe-events-bar.min.js and tribe-events.min.js depend on jquery.placeholder.min.js, so you’d either need to dequeue both of those as well, or remove the dependency for each.
As I reference these options, I see some work that we can do in keeping naming conventions consistent, particuarly naming the handle the same as the file name whenever possible. 🙂
hin
Tracking down the dependencies may be a bit confusing if you are looking to only some scripts and not all, but in lieue of documentation on this, you can look in lib/tribe-template-factory.class.php for a list of the scripts being loaded and their dependencies in the asset_package function.Let me know if this answers your question!
Cheers,
KyleAugust 1, 2013 at 4:26 pm #58419In reply to: Unhooking styles & scripts
Kyle
ParticipantHi Michael,
As Reid said, our team is actively in discussion on ways to consolidate scripts and styles for an upcoming release. I can say that we released a maintenance update today that fixes the identical stylesheet loading that you reported (thank you so much for the heads up, apologies for the oversight) as well as removed scripts and styles being loaded from the select2 library which we are no longer using on the front-end of the plugin.
As far as unhooking other scripts and styles as you wish, you can do so in your theme’s functions file with something like this:
function dequeue_tribe_events_scripts_and_styles() {
wp_dequeue_style( 'tribe_events-calendar-style' );
wp_dequeue_script( 'tribe-events-pro-geoloc' );
}
add_action('wp_enqueue_scripts', 'dequeue_tribe_events_scripts_and_styles', 100 );
This example would dequeue the main stylesheet, and the map js. use wp_dequeue_style and wp_dequeue_script with the name of the handle of the file you’d like to unhook. If you would like help with a specific file, I’d be happy to help out.
Cheers,
KyleJuly 10, 2013 at 11:37 am #54322In reply to: Events Calendar 3.0 Not Working with Theme
Cinch
ParticipantYes, but not why you think dequeueing is a potentially bad idea…
July 10, 2013 at 11:29 am #54321In reply to: Events Calendar 3.0 Not Working with Theme
Andy Fragen
ModeratorDidn’t this answer the dequeue question?
No apologies needed.
July 10, 2013 at 11:01 am #54317In reply to: Events Calendar 3.0 Not Working with Theme
Cinch
ParticipantWhere it’s loaded isn’t currently affecting this project, but I can see why you’d want it to load later. And then automatically NOT load the pro styles.
Any thoughts on my previous dequeue question? Thanks, and my apologies if I’m bugging you too much.
July 10, 2013 at 10:38 am #54308In reply to: Events Calendar 3.0 Not Working with Theme
Cinch
ParticipantThanks for the dequeue info Andy. Can you explain why dequeueing wouldn’t be a good idea?
I didn’t plan on enqueuing through the theme… Just putting everything within the theme css.
I’m interested in best practices… if there’s a better way to minimize the number of stylesheets loaded, I’m happy to do it. Do you prefer to concatenate through something like W3 Total Cache?
July 10, 2013 at 10:18 am #54305In reply to: Events Calendar 3.0 Not Working with Theme
Andy Fragen
ModeratorBryan, I’m not so sure dequeuing them all and enqueuing them in your theme is a good idea, but if you want to, the dequeue ID doesn’t include the final ‘-css’. That bit is added by WordPress.
The proper code would be wp_dequeue_style( ‘full-calendar-style’ );
July 10, 2013 at 10:09 am #54304In reply to: Events Calendar 3.0 Not Working with Theme
Cinch
ParticipantAndy,
Thanks for the override plugin idea. It’s doing it’s job and allowing me to override the plugin styles.
I’m looking forward to the update, as TEC currently loads 7!!! stylesheets, including the override. I’d much prefer to turn them all off and load them myself through the theme for minify/concatenation purposes.
Can you provide a full list of the correct dequeue ID’s? This: wp_dequeue_style( ‘full-calendar-style-css’ ); for example, is not working.
Thanks again,
~ BryanApril 22, 2013 at 9:05 am #46521In reply to: Removing unnecessary head tags
Jonah
ParticipantHi barrelny, the best way would be to use http://codex.wordpress.org/Function_Reference/wp_dequeue_script
Here’s an example:
function remove_styles() {
if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page
wp_dequeue_style( 'tribe_events-admin-ui' );
wp_dequeue_style( 'tribe-events-mini-calendar' );
wp_dequeue_style( 'tribe-events-calendar-style' );
}
}
add_action('wp_print_styles','remove_styles',1);function remove_scripts() {
if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page
wp_dequeue_script( ‘tribe-events-calendar-script’ );
wp_dequeue_script( ‘tribe-events-pjax’ );
wp_dequeue_script( ‘tribe-events-mini-calendar’ );
wp_dequeue_script( ‘jquery-ecp-plugins’ );
wp_dequeue_script( ‘chosen-jquery’ );
wp_dequeue_script( ‘tribe_events-admin’ );
}
}
add_action(‘wp_print_scripts’,’remove_scripts’,1);Does that help?
March 12, 2013 at 7:44 am #42359In reply to: Move scripts to footer
Jonah
ParticipantHi Shaun,
Here is an example of de-queueing one of our scripts and then registering and enqueueing your own. This should steer you in the right direction. Let me know if you need anything else.
/*-------------------------------------------------------------------------------
Add Custom events.js
-------------------------------------------------------------------------------*/
function example_enqueue_scripts() {
wp_dequeue_script('tribe-events-calendar-script');
wp_register_script('custom-events-calendar-script', get_template_directory_uri().'/js/events.js'); // notice it's not the same script name as the original one, that's important - otherwise it re-enqueues the old version
wp_enqueue_script('custom-events-calendar-script');
}
add_action('wp_enqueue_scripts', 'example_enqueue_scripts');
March 7, 2013 at 12:19 pm #41911Barry
MemberAlso, why do you say I might not need to dequeue the javascript?
Because it sounds as if you want to add new behaviour (showing the event details in a “modal” window, for instance, and prohibiting navigation via the mini-calendar to individual event pages) rather than wanting to strip away existing functionality.
The decision of course is yours, you will have a more complete understanding of what you want to achieve than I do 🙂
March 7, 2013 at 11:44 am #41899hoangker
Participanthi Barry,
thanks for the reply. But, you still left out why my overriding might not be working. I created the /events folder in my theme’s directory and copied table-mini.php and event.js, but, my changes to ~/theme/events/table-mini.php and ~/theme/events/event.js were not applied.
Also, why do you say I might not need to dequeue the javascript?
If I have the event $post->ID what function can I call to return me the details of the event (ex. event name, event date, thumbnail etc?)
Thanks,
Tin
March 7, 2013 at 11:22 am #41891Barry
MemberThere are excellent instructions on templating/theming here:
Javascript is a slightly different kettle of fish – there’s a brief overview here, just keep in mind that – for what you want to accomplish – you may not need to dequeue the scripts put in place by The Events Calendar.
-
AuthorSearch Results
