-
-
Save robincornett/d5cc3c225de4bf04924bfca718f66f89 to your computer and use it in GitHub Desktop.
Add a CTA (Call to Action) button to your MailChimp RSS emails.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// do not include the opening tag | |
// Disable the Read More link added by Send Images to RSS | |
add_filter( 'send_images_rss_excerpt_read_more', '__return_false' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// do not include the opening tag | |
add_filter( 'send_images_rss_excerpt_read_more', 'leaven_change_read_more_cta', 10, 5 ); | |
/** | |
* Modify the Send Images to RSS excerpt "read more" link output to be a button in MailChimp. | |
* | |
* @author Robin Cornett | |
* | |
* @param $output string final output for "read more" text | |
* @param $read_more string "read more" text set on plugin settings page | |
* @param $blog_name string the name of your site | |
* @param $post_name string the post name | |
* @param $permalink string URL for the post | |
* | |
* @return string | |
*/ | |
function leaven_change_read_more_cta( $output, $read_more, $blog_name, $post_name, $permalink ) { | |
// set your colors here | |
$button_color = '#2a717a'; | |
$link_color = '#ffffff'; | |
// for a full width button using your Read More text, you shouldn't need to change this | |
$output = '<table border="0" cellpadding="0" cellspacing="0" style="background-color:' . $button_color . '; border-radius:5px;" width="100%">'; | |
$output .= '<tbody>'; | |
$output .= '<tr>'; | |
$output .= '<td align="center" style="color:' . $link_color . '; font-weight:bold; line-height:1.5; padding-top:15px; padding-right:30px; padding-bottom:15px; padding-left:30px; margin: 24px auto;" valign="middle"><a href="' . $permalink . '" style="color:' . $link_color . '; text-decoration:none;" target="_blank">' . $read_more . '</a></td>'; | |
$output .= '</tr>'; | |
$output .= '</tbody>'; | |
$output .= '</table>'; | |
return $output; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*|RSSITEMS:|* | |
<h2 class="mc-toc-title"><a href="*|RSSITEM:URL|*" target="_blank">*|RSSITEM:TITLE|*</a></h2> | |
*|RSSITEM:CONTENT|* | |
<table border="0" cellpadding="0" cellspacing="0" style="background-color:#2a717a; border-radius:5px;" width="100%"> | |
<tbody> | |
<tr> | |
<td align="center" style="color:#FFFFFF; font-weight:bold; line-height:150%; padding-top:15px; padding-right:30px; padding-bottom:15px; padding-left:30px; margin: 24px auto;" valign="middle"><a href="*|RSSITEM:URL|*" style="color:#FFFFFF; text-decoration:none;" target="_blank">Read *|RSSITEM:TITLE|* on my site.</a></td> | |
</tr> | |
</tbody> | |
</table> | |
*|END:RSSITEMS|* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*|RSSITEMS:|* | |
<h2 class="mc-toc-title"><a href="*|RSSITEM:URL|*" target="_blank">*|RSSITEM:TITLE|*</a></h2> | |
*|RSSITEM:CONTENT|* *|END:RSSITEMS|* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment