Skip to content

Instantly share code, notes, and snippets.

@benheu
benheu / functions.php
Created November 30, 2023 17:01
Redirect to thank you page WP Wappointment
<?php
function my_wappo_redirect_appointment_confirmed()
{
echo '<script>';
echo "document.addEventListener('wappo_confirmed', function (e) {
window.location.replace('https://mysite.com/mythankyoupage');
@benheu
benheu / functions.php
Last active August 7, 2023 16:31
Create a WP user when a new booking is made: Shared by a Wappointment user (Gil)
<?php
add_action('wappointment_appointment_confirmed', 'my_function');
function my_function($eventObject){
$client = $eventObject->getClient();
$email = $client->email;
$name = $client->name;
@benheu
benheu / functions.php
Created July 24, 2023 22:43
All kinds of filters for Wappointment
<?php
add_filter('wappointment_admin_email_head_image', 'my_wappointment_admin_email_head_image', 10, 1);
function my_wappointment_admin_email_head_image($value){
return 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png';
}
add_filter('wappointment_admin_email_head_link', 'my_wappointment_admin_email_head_link', 10, 1);
@benheu
benheu / functions.php
Created June 13, 2023 16:26
Listening to a appointment confirmed event
<?php
add_action('wappointment_appointment_confirmed', 'my_function');
function my_function($eventObject){
$client = $eventObject->getClient();
$email = $client->email;
$name = $client->name;
/*
your code
*/
@benheu
benheu / functions.php
Last active July 3, 2022 14:25
Track appointment bookings with Google Tag for Google analytics
<?php
function my_wappo_analytics_appointment_confirmed()
{
echo '<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>';
echo "<script>
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
@benheu
benheu / front-subscribers.js
Created July 9, 2014 09:22
Current front-subscribers.js
// Return 1 if a > b
// Return -1 if a < b
// Return 0 if a == b
function version_compare(a, b)
{
if (a === b)
{
return 0;
}
@benheu
benheu / custom-shortcode-wp-user.php
Last active June 6, 2017 01:40
MailPoet 2.X - Custom shortcodes - How to retrieve normal WP user data?
<?php
/**
*
* @param string $tag_value
* @param int $user_id mailpoet's subscriber id
* @return type
*/
function mailpoet_shortcodes_custom_filter( $tag_value , $user_id ) {
@benheu
benheu / undo_unsubscribe_shortcode.php
Last active August 29, 2015 13:57
Generate a undo unsubscribe link to display in my theme
<?php
/**
* function to return an undo unsbscribe string for MailPoet newsletters
* you could place it in the functions.php of your theme
* @return string
*/
function mpoet_get_undo_unsubscribe(){
if(class_exists('WYSIJA') && !empty($_REQUEST['wysija-key'])){
$undo_paramsurl = array(
@benheu
benheu / wysija_get_subscription_link
Last active December 22, 2015 10:58
This is a sample function showing how to get a link toward the "Manage your subscriptions page" in Wysija http://wordpress.org/plugins/wysija-newsletters/description/