diff --git a/includes/class-newspack-newsletters.php b/includes/class-newspack-newsletters.php index 6462331ae..20f4deee6 100644 --- a/includes/class-newspack-newsletters.php +++ b/includes/class-newspack-newsletters.php @@ -560,5 +560,48 @@ public static function send_campaign( $id, $post ) { ]; $result = $mc->post( "campaigns/$mc_campaign_id/actions/send", $payload ); } + + /** + * Token replacement for newsletter templates. + * + * @param string $content Template content. + * @param array $extra Associative array of additional tokens to replace. + * @return string Content. + */ + public static function template_token_replacement( $content, $extra = [] ) { + $sitename = get_bloginfo( 'name' ); + $custom_logo_id = get_theme_mod( 'custom_logo' ); + $logo = $custom_logo_id ? wp_get_attachment_image_src( $custom_logo_id, 'full' )[0] : null; + + $sitename_block = sprintf( + '\n
Cras id dui. Nulla consequat massa quis enim. Phasellus a est. Fusce a quam. Phasellus gravida semper nisi.
\n\n\n\nProin faucibus arcu quis ante. Pellentesque posuere. Nunc sed turpis. Etiam sit amet orci eget eros faucibus tincidunt. Pellentesque dapibus hendrerit tortor.
\n\n\n\nAenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Phasellus consectetuer vestibulum elit. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Praesent nonummy mi in odio. Donec mollis hendrerit risus.
\n" + "title": "Template 2", + "content": "__LOGO_OR_SITENAME__\nStart your newsletter with an intro, sometimes known as a “topper.” This is where the lead writer or editor for the newsletter introduces the main storylines for the day. You might want to consider adding some bullet points to highlight the biggest stories of the day so that a reader can easily scan through this section. Those bullets could include:
\n\n\n\nYou may also want to ask a key question here at the top if you’re soliciting story ideas or tips from readers.
\n\n\n\nYou should also consider having this section bylined — it can help establish a relationship between a reader and your staff, and readers may be more likely to reply to a person than a generic voice.
\n\n\n\n—Byline
\n\n\n\nThis is where you can add additional context or a dek to tease this story. Try to add at least or sentence or two to the dek.
\n\n\n\nThis is where you'll put the dek for secondary stories. Make sure you really describe what’s in the story and give readers a reason to click.
\nThis is where you'll put the dek for the second story. Focus on curation here — don’t send a reader too many links. The goal is to get readers to your site. Once they’re there, you can focus on driving deeper engagement.
\nHow many links is too many? That’s worth testing out for yourself to see what works best for your audience, but start with about 5-7 links for this section and see how readers react.
\nFinally, make sure you have a call-to-action to support your work. This can be a few sentences like this, reminding readers of the value of your newsroom, or it can be an image. Either way, make sure you give a clear CTA and a unique link to track support back to this email.
\n\n\n\nStart your newsletter with an intro, sometimes known as a “topper.” This is where the lead writer or editor for the newsletter introduces the main storylines for the day. You might want to consider adding some bullet points to highlight the biggest stories of the day so that a reader can easily scan through this section. Those bullets could include:
\n\n\n\nYou may also want to ask a key question here at the top if you’re soliciting story ideas or tips from readers.
\n\n\n\nYou should also consider having this section bylined — it can help establish a relationship between a reader and your staff, and readers may be more likely to reply to a person than a generic voice.
\n\n\n\n—Byline
\n\n\n\nThis is where you can add additional context or a dek to tease this story. Try to add at least or sentence or two to the dek.
\n\n\n\nThis is where you'll put the dek for secondary stories. Make sure you really describe what’s in the story and give readers a reason to click.
\nThis is where you'll put the dek for the second story. Focus on curation here — don’t send a reader too many links. The goal is to get readers to your site. Once they’re there, you can focus on driving deeper engagement.
\nHow many links is too many? That’s worth testing out for yourself to see what works best for your audience, but start with about 5-7 links for this section and see how readers react.
\nFinally, make sure you have a call-to-action to support your work. This can be a few sentences like this, reminding readers of the value of your newsroom, or it can be an image. Either way, make sure you give a clear CTA and a unique link to track support back to this email.
\n\n\n\n