Site icon SumTips

Add Signature to WordPress Posts without Installing a Plugin

One way to give your WordPress blog a more personal touch is by adding a signature to the posts. So, here are two ways to automatically include a signature graphic to your blog posts, without installing an additional plugin.

WorPress Signature
WorPress Post Signature

Method 1:

Add the below code to your theme’s functions.php file:

function post_signature($sign) {
global $post;
if($post->post_type == 'post') $sign .= '<div class="signature">
<img src="" alt="signature" />
</div>';
return $sign;
}
add_filter('the_content','post_signature');

You can  see that the signature is wrapped in a DIV. This helps in styling it with CSS, if required. For example:

div.signature img {
float: right;
padding: 5px;
}

Method 2:

Another way to add a signature is by directly editing your theme’s template files.

For that, open index.php or single.php file with a text editor, and find a similar code:

<?php the_content(); ?>

Below this, add your signature:

<?php the_content(); ?>
<?php if (is_single())
{
echo '<div class="signature">
<img src="" alt="signature" />
</div>';
} ?>

Finally save the template file, and refresh blog to see result.

It’s recommend that your signature graphic be a transparent GIF or PNG file. Also make sure that it is no wider than the width of the content container of your WordPress Theme.

Exit mobile version