WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm checking /wp-includes/media-template.php and just found this:

<# if ( data.compat && data.compat.meta ) { #>
    {{{ data.compat.meta }}}
<# } #>

Never seen <# #> or {{{ }}} before. What kind of PHP is this?
Searching for this symbols in Google seems futile...

share|improve this question
up vote 7 down vote accepted

Those are javascript templates that get compiled into HTML by a javascript library. I think WP uses underscore.js.

Let's say you write a jQuery plugin, and you have to append HTML code to the document. Using such templates you can avoid stuffing that HTML code inside huge concatenated strings within your javascript code, and put it where the other HTML markup is. So you load that template from your plugin, compile it (variables get replaced) and append the resulting HTML to your document. Essentially you separate the business logic from the presentation logic. This also makes your plugin more decoupled.

share|improve this answer
Oh, sure, those blocks are inside the Html, bad title for the Q then... Deep stuff the core team got to make the new Media Library. – brasofilo Dec 14 '12 at 2:12
Just saw the update, seems that those doesn't pop up in the notification system. Nice addition :) And thx @toscho too for the good title. – brasofilo Dec 14 '12 at 23:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.