user2151960
user2151960

Reputation: 185

Wordpress Insert Text Link After Each post

I want to add a text link automatically after each post. I use this code in functions.php

function insertFootLink($content) {
    $content.= get_template_part( 'download','link');
    return $content;
}
add_filter ('the_content', 'insertFootLink');

Everything is OK, but the Text Link is inserted ABOVE the content, not AFTER.

Thank you!

Upvotes: 1

Views: 151

Answers (1)

rnevius
rnevius

Reputation: 27102

You can't use get_template_part() here, as it doesn't return anything. Instead, you'll need to include the file as a string (since the $content is also a string).

Assuming the file isn't executable PHP, one way to do this would be to use file_get_contents().

Upvotes: 1

Related Questions