As the title says I'm trying to remove and replace three or more <br>
from get_the_content();
in my single.php.
I'm currently using this but it doesn't seem to have any affect on the amount of <br>
in the document.
$content = get_the_content();
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$content = preg_replace('/(<br[\s]?[\/]?>[\s]*){3,}/', '<br /><br />', $content);
$content = strip_tags($content, '<br> <p> <a>');
echo $content;
This gives me the output:
<br />
<br />
<br />
<a href="http://1.bp.blogspot.com/-rYRPguEjEl8/UrSWUC_jEOI/AAAAAAAANm4/qVle4zdVfsQ/s1600/Alexa+NYC.jpg" imageanchor="1"></a>
<p>
<br />
<br />You don’t always have to stick to the same colour scheme
<br />
<br />
<br />
<br />
I can't seem to get the regex to work correctly.