Support » Themes and Templates » Why do template tags not allow being returned?

  • Resolved jakeisonline


    I find it very irritating that you can’t define all tags to be returned rather than echoed.

    I’m trying to re-work how comments are being processed in my theme, and now I can’t because I can’t return simple tags like comment_ID or comment_text – it’s not exactly hard to flag all tags with a true/false boolean to determine if the call wants it to be returned as echo or return does it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Damn, Google pulled through for me a little too late.

    This is badly documented, but appending get_ to the beginning of a template tag will return it rather than echoing it.


    foreach ($comments as $comment) {
       $get_comment_id // Will return the ID, but not print it to the page
       $comment_id // Will print it to the page, rather than return it.

    Handy to know, thanks for posting back your findings, i can’t say i would have realised that without you clearly explaining what you wanted and the difference between the 2.

    Not something that will help me at the moment but i had noticed the functions were printing the values rather then returning them.

    Thanx it will come in handy i’m sure.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Why do template tags not allow being returned?’ is closed to new replies.