[wp-trac] [WordPress Trac] #18561: Better Way to Insert Things Below Individual Posts

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 1 06:06:58 UTC 2011


#18561: Better Way to Insert Things Below Individual Posts
-------------------------+------------------------------
 Reporter:  jane         |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  3.2.1
 Severity:  minor        |  Resolution:
 Keywords:               |
-------------------------+------------------------------

Comment (by trepmal):

 Just expanding on my previously mentioned idea

 Easy to add content above - or below - the comments area (which is
 generally below the post content...)

 `$post` is passed to make it possible to customize the added content as
 needed.

 Very easy to use (screenshot: http://cl.ly/9mUI):

 {{{
 add_action( 'pre_comments_template', 'before_comments_template' );
 function before_comments_template( $post ) {
         ?>
         <div style="text-align:center;"><p style="border-top: 1px solid
 #333;border-bottom: 1px solid #333;">before the comments!</p></div>
         <?php
 }

 add_action( 'post_comments_template', 'after_comments_template' );
 function after_comments_template( $post ) {
         if ( 'closed' == $post->comment_status ) return;
         ?>
         <div style="text-align:center;clear:both;"><p>after the comments,
 if comments are open!</p></div>
         <?php
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18561#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list