[wp-hackers] Shortcode to call comments_template();

SWORD Studios info at swordstudios.net
Mon Apr 4 03:05:11 UTC 2011


I'm attempting to call the comments_template(); function in a shortcode.
Basically I want to call the comments template ONLY on a certain posts.
Below is the shortcode function I wrote.  Everything works but the
comments_template.


function sword_comment_shortcode($sword_comment_atts) {
  return '<h2 class="ltcol tk-league-gothic">I know you thought this was
great, others will too.</h2>
                   <article class="rtcol" ><span
class=\'st_facebook_vcount\' st_title=\'{TITLE}\' st_url=\'{URL}\'
displayText=\'share\'></span><span class=\'st_twitter_vcount\'
st_title=\'{TITLE}\' st_url=\'{URL}\' displayText=\'share\'></span><span
class=\'st_linkedin_vcount\' st_title=\'{TITLE}\' st_url=\'{URL}\'
displayText=\'share\'></span>
                            </article>
                        <div class="clear"></div>
                         <h2 class="ltcol tk-league-gothic">Share Your
Thoughts!</h2>
                   <article class="rtcol" >';

  comments_template();

  return '</article>
  <div class="clear"></div>';

 }
 add_shortcode('comments-shareit', 'sword_comment_shortcode');
-- 
*Jesse Friedman*   Founder / Lead Developer
*SWORD Studios* | 508.50.SWORD info at swordstudios.net
swordstudios.net @professor <http://twitter.com/professor>


More information about the wp-hackers mailing list