Skip to main content

Posts

Showing posts with the label auto add custom field

Inserting custom content after each post programmatically

There are time when you may want to automatically display a custom text below each of your posts. You can hard-code it, but why do it when there is better way to do so using a WordPress hook. Here’s how to do. Paste the following code into your functions.php and save the file. Custom content will be inserted below each of your posts. function add_post_content($content) { if(!is_feed() && !is_home()) { $content .= ' This article is copyright © '.date('Y').' '.bloginfo('name').' '; } return $content; } add_filter('the_content', 'add_post_content'); Related Articles: Inserts Posts Programmatically to WordPress Insert Categories & Tags Programmatically to WordPress