Last active
June 24, 2020 23:48
-
-
Save jamesmthornton/fc0a39d7a24f996f842db7525a4d1b7a to your computer and use it in GitHub Desktop.
Prepend a CTA to your RSS feed body/content or text to your subject line
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 | |
// prepend a call to action to your email body by adding before your the_content() | |
function prepend_rss_cta($content) { | |
$cta = ' <p><i>Want to share or link to this post? It lives here: <a href="' . get_the_permalink( get_the_ID() ). '">' . get_the_title( get_the_ID() ) . '</a>.</i></p>'; | |
$content = $cta . $content; // switch cta and content to append (not prepend) your CTA | |
return $content; | |
} | |
add_filter('the_content_feed', 'prepend_rss_cta'); | |
// prepend some text to your subject line by adding it to before your post title | |
function prepend_rss_title_subject_line($title) { | |
$acronym = '[TEI] '; | |
$title = $acronym . $title; | |
return $title; | |
} | |
add_filter('the_title_rss', 'prepend_rss_title_subject_line'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment