add content to bottom of single posts using functions.php
-
Hello WP.org world,
I am trying to add content to the bottom of every post.
I am using a child theme of Twenty Ten.
I want to add this content to the bottom of every post using my child theme’s functions.php.
Here is what I have, which sort of works but not really.
// add source link to syndicated posts function tsi_source_link() { if ( is_single() ) { global $post; $source_link = get_post_meta ($post->ID, 'syndication_permalink', true); if ($source_link) echo '<div id="tsi-source-link" style="text-align:right;"><a href="' . $source_link . '" target="_blank">Read more ...</a></div>'; } } add_action('the_content','tsi_source_link');Please don’t let the overcomplication of the above example confuse you in thinking about my problem. I am using a custom field to attribute the source with its originating permalink.
Okay so this works, but here is what does not work about it:
1. adding to ‘the_content’ puts this content above the post content, not at the bottom where I want it to be. Isn’t there some kind of ‘after_the_content’ hook/tag? How can I get this content to the bottom of the post?2. this function makes my Pages not show their content. probably because I am messing ‘the_content’ when I probably should not be?
I guess I should use some other function for this. I might simply edit one of the .php files directly. But I figure I’d throw it out here and maybe somebody will help me learn something. Most of my child-theming has been based off Thematic, now I am experimenting with Twenty Ten.
Thank you all, all the best!
Joe
The topic ‘add content to bottom of single posts using functions.php’ is closed to new replies.