This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This only works if you like to update the plugin. | |
* https://x.com/xaver_/status/1845760999908847628 | |
*/ | |
// load SCF from WP Engine servers | |
add_filter( 'pre_http_request', function ( $bool, $r, $url ) { | |
if ( false !== strpos( $url, '//downloads.wordpress.org/plugin/advanced-custom-fields.' ) ) { | |
$url = 'https://www.advancedcustomfields.com/latest/'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mailster_custom_excerpt_length( $length ) { | |
return 20; | |
} | |
add_filter( 'mailster_excerpt_length', 'mailster_custom_excerpt_length', 999 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'mailster_verify_subscriber', function( $entry ) { | |
if ( isset( $entry['firstname'] ) ) { | |
$names = explode( ' ', $entry['firstname'] ); | |
$entry['firstname'] = array_shift( $names ); | |
if ( ! empty( $names ) ) { | |
$entry['lastname'] = implode( ' ', $names ); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mailster_lists_only_unsubscribe($subscriber_id, $campaign_id){ | |
//unsubscribe user if campaign doesn't exists or isn't set | |
if(!mailster('campaigns')->get($campaign_id)) return; | |
$subscriber = mailster('subscribers')->get($subscriber_id); | |
if($subscriber){ | |
//change back to subscribed (silently) | |
mailster('subscribers')->change_status($subscriber_id, 1, true); | |
//get lists from the campaign |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'mailster_subscriber_subscribed', 'send_first_pregnancy_campaing' ); | |
function send_first_pregnancy_campaing( $subscriber_id ) { | |
//get subscriber | |
if ( $subscriber = mailster( 'subscribers' )->get( $subscriber_id ) ) { | |
$seachstring = "Pregnancy week %d"; | |
$total_weeks = 40; | |
//no birthdate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'mailster_verify_subscriber', 'my_mailster_verify_subscriber' ); | |
function my_mailster_verify_subscriber( $entry ) { | |
//verify subscriber with custom methods | |
return $entry; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'mailster_form', 'change_mailster_form_html', 10 , 3 ); | |
function change_mailster_form_html( $html, $form_id, $form ) { | |
//do some replacements | |
return $html; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_add_user_to_list_after_click_on_link ( $subscriber_id, $campaign_id, $target, $index ){ | |
$link = 'http://example.com'; | |
$list_id = 123; | |
$remove_from_old_lists = false; | |
if( $link == $target ){ | |
mailster('subscribers')->assign_lists($subscriber_id, $list_id, $remove_from_old_lists); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'body_class', 'add_class_if_subscriber' ); | |
function add_class_if_subscriber( $classes ) { | |
$user_ID = get_current_user_id(); | |
$subscriber = mailster('subscribers')->get_by_wpid($user_ID); | |
if($subscriber){ | |
$classes[] = 'is-mailster-subscriber'; | |
} | |
return $classes; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function append_date_to_auto_tag($pattern, $post_type, $options, $post){ | |
$pattern['content'] .= "<br>".'{'.$post_type.'_date:'.$options.'}'; | |
return $pattern; | |
} | |
add_filter('mailster_auto_tag', 'append_date_to_auto_tag', 10, 4); |
NewerOlder