Skip to content

Instantly share code, notes, and snippets.

Barry Hughes barryhughes

Block or report user

Report or block barryhughes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bbpress-add-date-created-on.php
<?php
add_action( 'bbp_theme_after_topic_started_by', function() {
$topic = bbp_get_topic( bbp_get_topic_id() );
if ( ! $topic || ! is_a( $topic, 'WP_Post' ) ) {
return;
}
try {
$date_created = date_create( $topic->post_date )->format( get_option( 'date_format' ) );
View ce-use-12hr-clock.php
<?php
function community_events_12hr_time() {
return 'g:i a';
}
function setup_time_option_filter() {
add_action( 'pre_option_time_format', 'community_events_12hr_time' );
}
function teardown_time_option_filter() {
View events-default-comment-status.php
<?php
/**
* Set the default comment status for events to 'closed'.
*
* Could easily be adapted to target all post types or a different
* post type.
*/
add_filter( 'get_default_comment_status', function( $status, $post_type ) {
if ( 'tribe_events' !== $post_type ) {
return $status;
View on-forum-post-status-transition.php
<?php
function on_forum_post_status_transition( $new_status, $old_status, $post ) {
// If we are not looking at a reply or a topic, bail!
if ( ! bbp_is_topic( $post ) && ! bbp_is_reply( $post ) ) {
return;
}
$forum_id = bbp_get_forum_id( $post );
$author_id = bbp_is_topic( $post )
? bbp_get_topic_author_id( $post )
@barryhughes
barryhughes / category-links-below-event-search-bar.php
Created Nov 16, 2018
Adds a list of clickable category links below the main event search bar (sometimes referred to as the "Tribe Bar"). Tested with TEC 4.6.26.
View category-links-below-event-search-bar.php
@barryhughes
barryhughes / custom-event-category-templates.php
Created Oct 25, 2018
An example of using a different theme template for different event categories.
View custom-event-category-templates.php
<?php
/**
* Use custom templates for event views when specific categories
* have been requested.
*/
class Event_Category_Templates {
/**
* This will be true if an event view has been requested.
*
* @var bool
View force-use-of-qr-security-code.php
<?php
add_filter('tribe_tickets_plus_qr_check_security_code', '__return_true' );
View generate-eventbrite-testing-data-v3api.php
<?php
# Quickly generate a set of test events on Eventbrite.com
# (from within a WordPress environment - useful for setting
# up test scenarios etc).
$token = '--YOUR-TOKEN-HERE--';
$date = date_create( '2019-01-01 12:00:00' );
for ( $i = 0; $i <= 60; $i++ ) {
$date->modify( '+2 days' );
@barryhughes
barryhughes / override-min-max-coords.php
Created Aug 8, 2018
Sample of overriding the min/max map view coords (ECP 4.4.30)
View override-min-max-coords.php
<?php
# Prohibit caching of geoloc center point/bounds
add_filter( 'pre_transient_geoloc_center_point_estimation', '__return_null' );
# Override the min/max coords
add_filter( 'tribe_geoloc_pre_get_min_max_coords', function() {
return [
'min_lat' => 30,
'max_lat' => 40,
'min_lng' => 20,
@barryhughes
barryhughes / modifiy-multiday-event-tooltips.php
Created Aug 7, 2018
Alter the date presented within month view tooltips for multiday events.
View modifiy-multiday-event-tooltips.php
<?php
/**
* Modifies the month view tooltip for multiday events.
*
* Instead of seeing "5 - 15 August", the tooltip for multiday event will show
* the date of the cell which contains it.
*
* For example, if a visitor hovers over the multiday event name within the cell
* for 11 August, the tooltip will now display "11 August" etc.
*/
You can’t perform that action at this time.