Skip to content

Instantly share code, notes, and snippets.

checkURLs: function( urls ) {
var percentage;
if ( urls.length == 0 ) {
finiquitado();
return;
}
// Le robamos una URL a esto
var url = urls.shift();
@igmoweb
igmoweb / app-hacks.php
Last active September 18, 2016 15:35
Appointments+: Automatically trigger Paypal button once confirmation is done
<?php
add_action( 'wp_footer', 'apppointmens_hacks_scripts', 20 );
function apppointmens_hacks_scripts() {
if ( wp_script_is( 'app-shortcode-confirmation', 'enqueued' ) ) {
?>
<script>
( function( $ ) {
$(document).on("app-confirmation-response_received", function() {
var paypalForm = $(".appointments-paypal > form");
@igmoweb
igmoweb / appointments.php
Created July 4, 2016 11:42
Update Event summary when an appointment is updatedRaw
<?php
add_filter( 'appointments_gcal_update_event', 'app_gcal_update_event_summary', 10, 2 );
function app_gcal_update_event_summary ( $event, $app ) {
if ( $event ) {
$appointments = appointments();
$event->setSummary( $appointments->get_service_name( $app->service ) . ' Appointment' );
}
return $event;
}
@igmoweb
igmoweb / appointments.php
Last active July 6, 2016 12:30
Overwrites GCal events title and description
<?php
add_filter( 'appointments_gcal_update_event', 'appointments_hooks_gcal_update_event', 10, 2 );
function appointments_hooks_gcal_update_event( $event, $appointment ) {
$appointments = appointments();
$gcal_api = $appointments->get_gcal_api();
$event = $gcal_api->appointment_to_gcal_event( $appointment->ID );
return $event;
}
@igmoweb
igmoweb / ltu.php
Last active July 6, 2016 17:26
Adds a link at the end of all emails with a link to unsubscribe page
<?php
add_filter( 'wp_mail', 'ltu_add_unsubscribe_links' );
function ltu_add_unsubscribe_links( $args ) {
if ( ! class_exists( 'IW_LTU' ) ) {
// Let Them Unsubscribe is not active
return $args;
}
$email = $args['to'];
@igmoweb
igmoweb / class-my-form-submit-ticket-form-shortcode.php
Created July 22, 2016 10:09
A custom shortcode ticket form for WPMUDEV Support System
<?php
class My_Form_Submit_Ticket_Form_Shortcode extends Incsub_Support_Shortcode {
public function __construct() {
add_action( 'template_redirect', array( $this, 'process_form' ) );
add_shortcode( 'support-system-submit-ticket-form', array( $this, 'render' ) );
}
public function process_form() {
if ( isset( $_POST['support-system-submit-ticket'] ) && incsub_support_current_user_can( 'insert_ticket' ) ) {
@igmoweb
igmoweb / jetpack.php
Last active August 10, 2016 15:29
Carga ciertos módulos de Jetpack sin activar Jetpack y oculta Jetpack a los usuarios
<?php
class Jetpack_Mandatory_Modules {
public function __construct() {
add_action( 'plugins_loaded', array( $this, 'load_base_jetpack' ) );
// Este hook marcará los módulos obligatorios como activados
// aquellos obligatorios que nosotros queremos
@igmoweb
igmoweb / jetpack-mandatory-redux.php
Created August 10, 2016 15:49
Carga módulos obligatorios en Jetpack esté o no activado
<?php
class Jetpack_Mandatory_Modules {
public function __construct() {
$active_plugins = get_option( 'active_plugins' );
if ( ! in_array( 'jetpack/jetpack.php', $active_plugins ) ) {
// Jetpack está desactivado pero lo vamos a cargar y ocultar
@igmoweb
igmoweb / divi-hummingbird.php
Last active September 27, 2016 21:41
It avoids minification and concatenation for Divi assets (assets slugs must be filled)
<?php
if ( $is_divi_builder_loaded ) {
// This won't activate minification while Divi builder is loaded in front
add_filter( 'wp_hummingbird_is_active_module_minify', '__return_false', 50 );
}
// Don't minify Divi assets in any case
add_filter( 'wphb_minify_resource', function( $minify, $handle, $type ) {
@igmoweb
igmoweb / react-plugin-1.php
Created October 7, 2016 15:09
Plugin para practicar con React (I)
<?php
/**
* Plugin Name: React Plugin
*/
class React_Plugin {
private $page_id;
public function __construct() {