Skip to content
Advertisement

weird usage of php open and close tag in callback functions

This is a piece of TwentyTwelve WordPress theme which actually proposed as a good material for learning theme development by WordPress itself.

This function is sent as a callback. But the thing is the weird usage of PHP open and close tags in the code:

I’ve marked them with this comment: /* <—— LIKE THIS */

JavaScript

why are they used in this way?

Advertisement

Answer

It’s not a clean code but it’s not strange as you think, the php tag are closed when the function print directly html, you can change your code like this:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement