Skip to content

Instantly share code, notes, and snippets.

### Begin System Info ###
** WORDPRESS DATA **
Multisite: No
SITE_URL: https://rishelsolutions.com/dev
HOME_URL: https://rishelsolutions.com/dev
WP Version: 4.9.5
Permalink: /%year%/%monthnum%/%day%/%postname%/
Cur Theme: Twenty Seventeen 1.4
Post Types: post, page, attachment, revision, nav_menu_item, custom_css, customize_changeset, oembed_cache, wp_block, tribe_venue, tribe_organizer, tribe_events, tribe-ea-record, deleted_event
@erishel
erishel / hide-past-events.php
Created May 11, 2018 18:29
TEC - Hide past events
add_filter('tribe_events_pre_get_posts', 'filter_tribe_all_occurences', 100);
function filter_tribe_all_occurences ($wp_query) {
if ( !is_admin() ) {
$new_meta = array();
$today = new DateTime();
// Join with existing meta_query
//Add to functions.php
add_filter( 'tribe_get_events_title', 'change_month_title_wording' );
function change_month_title_wording( $title ) {
return str_replace( 'Events for', '', $title );
}
@erishel
erishel / experimental-smart-month-search.php
Created May 17, 2018 23:56 — forked from barryhughes/experimental-smart-month-search.php
Improve month view search so it is not restricted to the current month. Experimental! Use at own risk, there are known bugs/quirks with this code.
<?php
/**
* If a search is conducted in month view but the relevant events
* are in a different month, switch to that month.
*
* Experimental! Especially during live ajax navigation, there are
* parts of this that don't work cleanly (pushstate/URL changes).
* Unsupported, use at own risk.
*/
class Transmogrified_Month_View_Search {
@erishel
erishel / change_events_view_titles.php
Created May 19, 2018 01:43 — forked from theeventscalendar/change_events_view_titles.php
Changes the title/headings on Events views
<?php
/*
* Alters event's archive titles
*/
function tribe_alter_event_archive_titles ( $original_recipe_title, $depth ) {
// Modify the titles here
// Some of these include %1$s and %2$s, these will be replaced with relevant dates
$title_upcoming = 'Upcoming Events'; // List View: Upcoming events
/*-----------------------------------------------------------------------------------*/
/* The Events Calendar - Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if ( tribe_is_month() && ! is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif ( tribe_is_month() && is_tax() ) { // Month View Category Page
@erishel
erishel / sample functions with changed text.php
Created May 24, 2018 01:31 — forked from theeventscalendar/sample functions with changed text.php
This is an example of a functions.php file with custom text added.
<?php
/*
* EXAMPLE OF CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR
* See the codex to learn more about WP text domains:
* http://codex.wordpress.org/Translating_WordPress#Localization_Technology
* Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
*/
function tribe_custom_theme_text ( $translation, $text, $domain ) {
function vehicle_details() {
// Add new "Vehicle Details" taxonomy
register_taxonomy('vehicle_details', 'vehicle', array(
// Hierarchical taxonomy (like categories)
'hierarchical' => true,
'public' => true,
@erishel
erishel / tooltip.php
Last active June 2, 2018 20:45 — forked from nefeline/tooltip.php
Adds permalink to bottom of tooltip
<?php
/**
* Adds permalink to bottom of tooltip
*
* Add this template on:
*
* [your-theme]/tribe-events/month/tooltip.php
*/
?>
@erishel
erishel / tribe_prevent_ajax_paging.php
Created June 12, 2018 17:41 — forked from elimn/tribe_prevent_ajax_paging.php
MT | TEC | Prevent Next/Prev pages from being loaded via Ajax in List and Month views
<?php
/*
* Prevents Next/Prev pages from being loaded via Ajax in List and Month views
*/
function tribe_prevent_ajax_paging() {
echo "
<script>
jQuery(document).ready(function(){