Skip to content

Instantly share code, notes, and snippets.

@cdevroe
Last active March 27, 2025 19:51
Show Gist options
  • Save cdevroe/10dde8d168c1d8c6a98dcc1940dfe5bd to your computer and use it in GitHub Desktop.
Save cdevroe/10dde8d168c1d8c6a98dcc1940dfe5bd to your computer and use it in GitHub Desktop.
Extended Hubbub Pro's Save This email to include a link from an ACF field
<?php
function hubbub_save_this_filter_add_book_button( $email_message, $post_id, $is_shortcode ) {
if (class_exists('ACF')) { // Check to make sure Advanced Custom Fields is active
$bookURL = get_field( $selector, $post_id );
if ( ! $bookURL ) $bookURL = '';
$email_message = str_replace( '{BOOK_BUTTON}', '<a href="' . $bookURL .'">Download Book</a>', $email_message );
}
return $email_message;
}
add_filter( 'hubbub_save_this_filter_email_message', 'hubbub_save_this_filter_add_book_button' 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment