Support » Plugin: MailPoet Newsletters » Add excerpt text separate from Automatic Content

  • Please excuse the noobishness of the questions, I’m way out of my depth.

    I’m attempting to have a newsletter send automatically daily, with only a single post in the automatic content. However, I would also like the post excerpt in the body above the automatic content. I attempted to use the instuctions on http://beta.docs.mailpoet.com/article/160-create-your-own-custom-shortcode, but got lost

    I added

    add_filter(‘mailpoet_newsletter_shortcode’, ‘mailpoet_custom_shortcode’, 10, 5);
    function mailpoet_custom_shortcode($shortcode, $newsletter, $subscriber, $queue, $newsletter_body) {
    // always return the shortcode if it doesn’t match your own
    if ($shortcode !== ‘[custom:excerpt]’) return $shortcode;

    $excerpt = get_the_excerpt($post);

    return $excerpt;
    }

    this returns “excerpt” as a string, as opposed to the full excerpt string, if that makes sense. I think this is the expected error functionality, but it’s obviously not what I’m after.

    Any help to pull out the actual excerpt would be greatly appreciated.

  • You must be logged in to reply to this topic.