Home » Labs » How to add custom content to WordPress post  

How to add custom content to WordPress post

Filed under Labs

WordPress is a 360 degree flexible content management system which allow developers to make customization on design and code. Here is a code which allow you to publish default content after each post. For example if you want to publish a message/copyright on every post it will be helpful. you can add below function to your functions.php file in WordPress theme directory.

function add_custom_content($content) {
        if(!is_feed() && !is_home()) {
                $content .= '<p>Your copyright message here,  copyright © '.date('Y').' '.bloginfo('name').'</p>';
        return $content;
add_filter('the_content', 'add_custom_content');

Posts you may like: