Is this possible? <div id="example" title="is possible put PHP code here?"> some text </div>
I want put <?php the_excerpt(); ?> in the Title attribute
Is this possible? <div id=example title=is possible put PHP code here?> some text </div>
Share
Yes.
or:
The latter is a shorthand that automatically echoes everything in the PHP block, whereas the former can contain any code, including code that echoes something (prints it to where the block is).
See basic syntax.
Take note, however, to escape anything you output to HTML, to make sure it’s a valid attribute value (unless
the_excerpt()already returns an escaped string):