Content Marketing

Customize Your WordPress Feed With A Featured Image and Copyright Statement (Pre and Post Content)

One interesting thing about WordPress is that the featured image has never been incorporated into the RSS feed. This is a bit unfortunate, as selecting or designing the featured image can draw much attention to an article.

Prepend Content To The Posts In Your RSS Feed

To prepend the featured image to your content isn’t too difficult. Here’s the code that I added to my WordPress functions.php in my Child Theme file:

function prerssfeedcontent($content) {
	global $post;
	$current_year = date('Y');
	$post_title = get_the_title( $post->ID );
	$post_link = get_permalink( $post->ID );
	$post_image = get_the_post_thumbnail( $post->ID, 'medium' );

	// Add the featured image
	if ( has_post_thumbnail( $post->ID ) ) {
		$precontent = '<p class="thumb">';
		$precontent .= '<a href="' .$post_link. '" title="' .$post_title. '">';
		$precontent .= $post_image;
		$precontent .= '</a></p>';
	}

	$content = $precontent . $content;

	return $content;
}
add_filter('the_excerpt_rss', 'prerssfeedcontent');
add_filter('the_content_feed', 'prerssfeedcontent');

Additionally, I also want to add content at the end of my feed posts.

Append Content To The Posts In Your RSS Feed

As I’m reviewing backlinks to Martech Zone, I often find that there are sites that are stealing my content and publishing it as their own on their site. It’s an endless chase and aggravating. There are plenty of times that I can track them down; other times, I can report them to their ad networks and hosting providers. But often, they’re largely anonymous and hard to track down… if at all.

As a result, my only choice is to customize my feed and include a copyright statement so unauthorized site visitors can see the source. To do this, I updated the above function to prepend and append the information I wanted.

function prepostrssfeedcontent($content) {
	global $post;
	$current_year = date('Y');
	$post_title = get_the_title( $post->ID );
	$post_link = get_permalink( $post->ID );
	$post_image = get_the_post_thumbnail( $post->ID, 'medium' );
	$company_title = "DK New Media, LLC";
	$company_link = "https://martech.zone/partner/dknewmedia/";

	// Add the featured image
	if ( has_post_thumbnail( $post->ID ) ) {
		$precontent = '<p class="thumb">';
		$precontent .= '<a href="' .$post_link. '" title="' .$post_title. '">';
		$precontent .= $post_image;
		$precontent .= '</a></p>';
	}

	// Add the copyright
	$postcontent = '<p>&copy;';
	$postcontent .= $current_year;
	$postcontent .= ' <a href="'.$company_link.'">'.$company_title.'</a>, All rights reserved.</p>';
	$postcontent .= '<p>Originally Published on Martech Zone: <a href="'.$post_link.'">'.$post_title.'</a></p>';

	$content = $precontent . $content . $postcontent;

	return $content;
}
add_filter('the_excerpt_rss', 'prepostrssfeedcontent');
add_filter('the_content_feed', 'prepostrssfeedcontent');

You can view the result on my feed… the featured image is displayed as well as the copyright and original source links at the end of each post.

View Martech Zone Feed

Appreciate this content?

Sign up for our weekly newsletter, which delivers our latest posts every Monday morning.

We don’t spam! Read our privacy policy for more info.

Douglas Karr

Douglas Karr is a fractional Chief Marketing Officer specializing in SaaS and AI companies, where he helps scale marketing operations, drive demand generation, and implement AI-powered strategies. He is the founder and publisher of Martech Zone, a leading publication in marketing technology, and a trusted advisor to startups and enterprises alike. With a track record spanning more than $5 billion in MarTech acquisitions and investments, Douglas has led go-to-market strategy, brand positioning, and digital transformation initiatives for companies ranging from early-stage startups to global tech leaders like Dell, GoDaddy, Salesforce, Oracle, and Adobe. A published author of Corporate Blogging for Dummies and contributor to The Better Business Book, Douglas is also a recognized speaker, curriculum developer, and Forbes contributor. A U.S. Navy veteran, he combines strategic leadership with hands-on execution to help organizations achieve measurable growth.

Related Articles

Back to top button
Close

Adblock Detected

We rely on ads and sponsorships to keep Martech Zone free. Please consider disabling your ad blocker—or support us with an affordable, ad-free annual membership ($10 US):

Sign Up For An Annual Membership