1

Is it possible to combine specific commands from PHP with styles? I display data via following command:

echo esc_html( $text )

How is it possible to display the data like a headline <h3> tag?

I tried to simply add it, but that does not work:

'<h3>' . echo esc_html( $text ) . '</h3>';

Any ideas?

1
  • echo '<h3>' . esc_html( $text ) . '</h3>'; Commented Jul 26, 2019 at 15:55

1 Answer 1

3

You may want to check Escaping from HTML. In your case:

<h3><?php echo esc_html($text); ?></h3>

Alternatively, just feed echo with as many arguments as needed:

<?php
echo '<h3>', esc_html($text), '</h3>';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.