Every time WordPress runs, a number of key settings are loaded into memory, such as details about how to connect to the database. These settings are generally defined as constants within the
wp-config.php file, and it’s entirely possible to change or add to them in order to tweak WordPress and modify it’s behavior slightly.
If you are reading this it won’t come as much of a surprise to learn that The Events Calendar can also be tweaked simply by defining some new constants within
What I am going to look at in this article is each of the six constants that can be used to fine tune The Events Calendar — though one is deprecated and really we are only documenting that for completeness (and for the benefit of anyone working on an older installation, where an update has not been possible for whatever reason).
Now, as I alluded to at the start, some pretty critical information is stored in
wp-config.php (database credentials, for instance) so it is imperative that you make a copy of this file before you start editing… just in case. The constants we will look at are:
Defining constants is straightforward:
Noting that, as is conventional, the name of the constant is all uppercase. Don’t make the mistake of changing this to lowercase or anything else. Here’s an example:
You can see that in the above screenshot I have defined
TRIBE_HIDE_UPSELL, setting it to
true. It’s that easy.
Throughout the admin screens for our plugin, you’ll notice links and information about our other plugins that are available as add-ons for The Events Calendar. Using
TRIBE_HIDE_UPSELL will remove the admin menu items for these add-ons as well as all the other upsell text used throughout the admin screens for the plugin.
For more information check out our article on Removing the Add-On Upsell.
Disable toolbar items
By default, a handy menu is added to the WordPress toolbar allowing rapid access to various event pages and settings. This same menu may also be populated with items by various add-ons (such as Community Events) if you happen to have them installed.
This isn’t always desirable, though: it might be that your toolbar is already crowded with menus added by other plugins or it could just be that you need to keep things as simple as possible for your client.
As you’ve probably guessed, we have also made it possible to disable this by means of defining a constant:
Disable automatic update notifications
If you would like to prevent The Events Calendar from looking for updates and prompting automatic updates use
TRIBE_DISABLE_PUE. Setting this to
true will prevent your site for looking for the latest version of The Events Calendar when checking for normal updates to themes or plugins.
PUE update URL
PUE_UPDATE_URL is quite simply the URL used to check for updates. Generally speaking there is no need to change this, however, if we ever moved our update systems to a different domain (which is unlikely) it’s possible that you would need to define this to continue receiving updates.
Prevent deprecated functions from loading
Over time, some functions available within a plugin get replaced with different functionality or better approaches to the solution are developed. As a consequence, some of these old functions become “Deprecated”. However, since some users may have previously taken advantage of these functions, we don’t want to completely remove them from our plugin. This would be a bad practice when considering backward compatibility since our plugin updates would cause our customer’s sites to break.
However, with deprecated functions, there may be some naming conventions that cause conflicts with your theme or other plugins. This happens when other functions with identical names get defined elsewhere in the active code. To prevent this, use
TRIBE_DISABLE_DEPRECATED_TAGS to prevent these functions from loading and preventing them from conflicting with the rest of the code on your site.
Fix title conflict with certain themes
Have you noticed that sometimes the title for an event page isn’t displaying properly? Is it displaying twice or are loops of events displaying a single event title rather than an appropriate archive title? This could be due to your theme calling
the_title(); outside of the loop for that page.
To fix this problem, use
TRIBE_MODIFY_GLOBAL_TITLE to overwrite the default title being output by the theme.
Bypass single event style changes
The following constant can be added so that the updated single event styles can be overridden by any customizations that you’ve made there:
Similarly, the can be done with a filter:
add_filter( 'tribe_events_single_view_v2_is_enabled', '__return_false' )
Revert to legacy widget styles
The following constant can be added if you’d like to revert to the legacy widget styles:
define( 'TRIBE_EVENTS_WIDGETS_V2_DISABLED', true );
We hope this was of value to you. If there’s another constant you think might be worth adding or have questions about any of those outlined above, let us know!