Skip to content

Instantly share code, notes, and snippets.

View bordoni's full-sized avatar
:shipit:
Working on The Events Calendar

Gustavo Bordoni bordoni

:shipit:
Working on The Events Calendar
View GitHub Profile
<?php
/**
* Remove MailPoet Action on the Unsubscribe page `the_content`
*/
add_action( 'init', '__mailpoet_unsubscribe_page' );
function __mailpoet_unsubscribe_page() {
if ( class_exists( 'WYSIJA_help_front' ) && ! is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] === 'subscribe' ) {
$front_helper = WYSIJA::get('front','helper');
<?php
/**
* Print MailPoet's Widget without having a Sidebar
*
* Reference: http://codex.wordpress.org/Function_Reference/the_widget
*/
the_widget(
'WYSIJA_NL_Widget', // Name of the widget
array( // Variables that will configure the Widget
'title' => 'Subscribe to our Newsletter',
@bordoni
bordoni / format.php
Last active August 29, 2015 13:57
Format in PHP
<?php
/**
* Ref: http://stackoverflow.com/questions/7683133/does-php-have-a-feature-like-pythons-template-strings
*/
class Helper_StringFormat {
public static function sprintf($format, array $args = array()) {
$arg_nums = array_slice(array_flip(array_keys(array(0 => 0) + $args)), 1);
$.ajax({
'url': ajaxurl,
'data': {
'action': data.crop_action,
'crop': data.crop,
'attachment': data.$.return.val()
},
'dataType': 'json',
'type': 'POST',
'success': function (response, textStatus, jqXHR){
@bordoni
bordoni / Twitch.py
Last active August 29, 2015 14:10 — forked from Xeroday/Twitch.py
import requests
import subprocess
import json
import sys
import threading
import time
from Queue import Queue
numberOfViewers = int(sys.argv[1])
builderThreads = int(sys.argv[2])
@bordoni
bordoni / functions.php
Last active August 29, 2015 14:14
Remove HTML from Google Export Link on The Events Calendar
<?php
/*
* If you already have something in your functions.php, please remove these first few lines
*/
add_filter( 'tribe_google_calendar_parameters', 'tec_hook_938252', 11 );
function tec_hook_938252( $params ){
// Since in our code we urlencode you need to first urldecode before doing anything
$params['details'] = urlencode( strip_tags( urldecode( $params['details'] ) ) );
@bordoni
bordoni / gist:a1c7248d60f4726f0845
Created January 28, 2015 13:45
Enqueue the `tribe_js_config` variable on Salient WordPress theme
<?php
/*
* Open your Functions.php file
* On your `nectar_register_js` function after the `wp_register_script` for the `nectarFrontend`, you will append the following code
*/
$js_config_array = array(
'permalink_settings' => get_option( 'permalink_structure' ),
'events_post_type' => TribeEvents::POSTTYPE
);
@bordoni
bordoni / functions.php
Last active August 29, 2015 14:14
Event Featured image defaults to venue Featured image then to a Defaults URL
<?php
/*
* If you already have something in your functions.php, please remove these first few lines
*/
add_filter( 'tribe_event_featured_image', 'tec_forum_938271', 11, 3 );
function tec_forum_938271( $featured_image, $post_id, $size ){
if ( ! empty( $featured_image ) ){
return $featured_image;
}
@bordoni
bordoni / functions.php
Created January 29, 2015 13:02
Moving The Google Calendar and iCalendar links to organizer box
<?php
/*
* If you already have something in your functions.php, please remove these first few lines
*/
// First solution - links below the organizer section
add_action( 'tribe_events_single_meta_organizer_section_end', array( 'TribeiCal', 'single_event_links' ) );
remove_action( 'tribe_events_single_event_after_the_content', array( 'TribeiCal', 'single_event_links' ) );
// Second solution - links on the right of the organizer box (after)