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

Matt Martz matt at sivel.net
Mon Apr 4 03:21:49 UTC 2011


On Sun, Apr 3, 2011 at 10:19 PM, SWORD Studios <info at swordstudios.net> wrote:
>
> Haha, wow, I should be going to bed when that happens (late night).  Thanks
> that immediately fixed it.
> Now the comments are coming in above the content in the post.  I have a few
> paragraphs of content then at the bottom is the shortcode.  However when you
> view the post it has the comments above everything else.  Any idea why?

For starters shortcodes need to return, and comments_template does an
include() which is basically echoing.  Likely the only way you will
get it to work is to output buffer it, put the output into a var and
then add it to the return.  Of course this will increase memory usage,
and blah blah blah...Don't feel like typing any more, but you likely
know of the down falls of output buffering, but it is likely your only
option here.

-- 
Matt Martz
matt at sivel.net
http://sivel.net/


More information about the wp-hackers mailing list