Adding footers to posts?

I’m trying to add footers to the end of my posts. I need to be able to assign different footers to different posts (not globally).

I tried using WP Post Footer, but it’s not working on WP 3.1.2.

Related posts

Leave a Reply

4 comments

  1. Here is a quick solution for you:

    on the page or post you want to add a post footer create a new custom field named post_footer and in the value add the footer content.

    then paste this code in your theme’s functions.php file

    add_filter('the_content',`my_post_footer`,99);
    function my_post_footer($content){
       global $post;
       $footer = get_post_meta($post->ID,'post_footer',true);
       if ($footer){
          return $content . $footer;
       }
       return $content
    }
    

    and you are done!
    This way you can have different footers on each page/post and none at all if you don’t want it.

  2. Was able to get WP Post Footer working. The online instructions at WP Plugin page is missing an instruction (found it in the readme in the zip pkg).

    Need to add the following line to the Single.php module for the theme you are using:

    <?php if (function_exists('wp_post_footer')) wp_post_footer(); ?>
    
  3. Anything you add, inside the Loop, but after the call to either the_content() or the_excerpt(), will, in essence, be a Post “footer”.

    Say you have:

    <div <?php post_class(); ?>
         <div class="post-header">
              <h1><?php the_title(); ?></h1>
         </div>
         <div class="post-entry">
              <?php the_content(); ?>
         </div>
    </div>
    

    You could do something like this:

    <div <?php post_class(); ?>
         <div class="post-header">
              <h1><?php the_title(); ?></h1>
         </div>
         <div class="post-entry">
              <?php the_content(); ?>
         </div>
         <div class="post-footer">
              <p>Hello! I'm a Post Footer!</p>
         </div>
    </div>
    

    To give specific instruction, we’ll need to know what Theme you’re using.

  4. Someone may have a more elegant solution, but if you’re comfortable editing some of the template files, you can copy your footer.php and rename to footer-alt.php or whatever suits you. Make the changes you need, and in the template file you’re using for the specific post-type, replace <?php get_footer(); ?> with <?php include("footer-alt.php"); ?>

    If you keep the div and class names the same, you should not have any issues with the layout.

    Cheers!