Skip to content

Instantly share code, notes, and snippets.

@bappi-d-great
Created November 8, 2018 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bappi-d-great/585bb6ffeb703e500e84f2073d495723 to your computer and use it in GitHub Desktop.
Save bappi-d-great/585bb6ffeb703e500e84f2073d495723 to your computer and use it in GitHub Desktop.
Forminator add more email macro
<?php
// Email macro: {last-post-link}
add_filter( 'forminator_replace_variables', function( $content, $content_before_replacement ) {
$args = array( 'numberposts' => '1' );
$recent_posts = wp_get_recent_posts( $args );
$post = '<a href="' . get_permalink( $recent_posts[0]['ID'] ) . '">' . get_the_title( $recent_posts[0]['ID'] ) . '</a>';
return str_replace( '{last-post-link}', $post, $content );
}, 99, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment