Replace string in footer with dynamic content
-
I’ve created custom html template under theme, and created custom footer now I want to create unsubscribe link with email address in query string, show I’ve applied filter like bellow.
add_filter( 'haet_mail_use_template', 'change_email_content_by_message', 10, 2 ); function change_email_content_by_message( $use_template, $email ){ $unsubscribe_link = add_query_arg( array( 'is_event' => true, 'email' => $email['to'], ), home_url('/mailchimp-api-edit-profile/') ); $unsubscribe_afmelden = "<a style='font-family: \"Lucida Grande\", \"Lucida Sans Unicode\", \"Lucida Sans\", Geneva, Verdana, sans-serif; font-size: 12px; color: #d5882a; text-decoration: underline;' href='".$unsubscribe_link."'>afmelden</a>"; $unsubscribe_voorkeuren = "<a style='font-family: \"Lucida Grande\", \"Lucida Sans Unicode\", \"Lucida Sans\", Geneva, Verdana, sans-serif; font-size: 12px; color: #d5882a; text-decoration: underline;' href='".$unsubscribe_link."'>voorkeuren wijzigen</a>"; $email['message'] = str_replace( "{#unsubscribe_afmelden#}", $unsubscribe_afmelden, $email['message'] ); $email['message'] = str_replace( "{#unsubscribe_voorkeuren#}", $unsubscribe_voorkeuren, $email['message'] ); return $email; }But above code is only showing message before it replace the template, so can you please suggest me the hooks or code to replace specific string with dynamic content.
The topic ‘Replace string in footer with dynamic content’ is closed to new replies.