Support » Plugins » I’d like a standard footer on every article – is this possible?

  • I want to set something up on my blog, so that at the end of every article, there is a standard ‘footer’ with some generic information.

    I just want it to say something like “This artices was written by joe blogs who works for abc inc, he is an expert in xyz – contact him with any quereie etc etc

    Is there a plugin or some way of doing this?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • If you have a look at your theme, in the index.php (and single.php, archive.php) it probably gives some code that says: “this post is written by author” (in code of course). Just look up that bit, see the fixed text (often “by”) and edit it a little.
    I’m not the right person to talk you through the exact coding, but there you may have an idea what you’re looking for.

    Is there a plugin or some way of doing this?

    try the following code; add inside your theme’s functions.php

    <?php
    function my_generic_carbon_footprint($content)
    {	global $wp_query;
    
    	if ($wp_query->is_singular){
    	$msg = __('This artices was written by joe who works for abc inc, he is an expert in xyz - contact him with any quereie et cetera');
    	$msg = '<p class="entry-footer">'.$msg.'</p>';
    	return $content.PHP_EOL.$msg;
    	} else {
    		return $content;
    	}
    }
    
    add_filter('the_content','my_generic_carbon_footprint');
    ?>

    Hm, functions.php…
    Zascar, listen to Chaos, she’s much better in CSS and PHP than I am. I work on trial-and-error, she on knowledge!

    Instead of adding a function to your functions.php file I am inclined to agree with Gangleri and suggest you add it to the template.

    Just below where your single.php (for permalink pages) has <?php the_content(); ?> put what you want to display.

    <div class="postfoot">This post was by .....</div>

    If you don’t have a single.php file in your theme, add it below <?php the_content(); ?> like this to limit it to permalink pages only:

    <?php if(is_single()): ?><div class="postfoot">This post was by .....</div><?php endif; ?>

    If you want it to display the name dynamically by the author of the post you use the author template tags. Like:

    <div class="postfoot">This post was by <?php the_author(); ?> is <?php the_author_description(); ?></div>

    I like using the author description cause it allows you to change the description in the admin interface in the profile.

    Perfect thanks guys

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘I’d like a standard footer on every article – is this possible?’ is closed to new replies.