0

There is a heading output in my ad statistics page (WordPress):

<h3 id="ad-title"><?php printf( __( 'Statistics for %s', 'advanced-ads-tracking' ), $ad_name ); ?></h3>

I want to add a line break after the “Statistics for” part.

The Find and Replace plugin (filters HTML after generated by WP and before it’s sent to the browser) is not able to replace the string, I am not sure why – my ad stats page is generated within the WordPress context so it should work, but it doesn’t.

There is no filter hook in ad-stats.php, there is only an action hook. But I cannot use an action hook to replace a string, I would need a filter hook.

I want to use str_replace to replace the string, adding the line break in it.

How do I do that?

Or can I add a filter hook?

1 Answer 1

0

just add <br />in this way.

\n is only working with echo or nl2br() method.

but when we need to break line in print_r() we use<br/>this way and it works.

i create example for you, please check. https://www.awesomescreenshot.com/image/23177408?init_open=true

2
  • The link gives a 404. The concern and the question is not about what character to use for the line break. The concern is how to implement the code change without using a filter hook? There is no filter hook available. Commented Mar 1, 2022 at 6:41
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 4, 2022 at 20:24

Your Answer

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

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