filters – How do I add a line break to a string that is output by PHP?

Question

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?

0
Adam Alleman 6 months 2022-02-28T23:48:07-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse