<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Low Frequency Ops &#187; line break</title>
	<atom:link href="http://lowfrequencyops.com/tag/line-break/feed/" rel="self" type="application/rss+xml" />
	<link>http://lowfrequencyops.com</link>
	<description>Production &#124; Promotion &#124; Culture &#124; Music &#124; Art</description>
	<lastBuildDate>Thu, 11 Mar 2010 04:06:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Fix for the dredded Wordpress paragraph spacing problem!</title>
		<link>http://lowfrequencyops.com/2009/10/20/fix-for-the-dredded-wordpress-paragraph-spacing-problem/</link>
		<comments>http://lowfrequencyops.com/2009/10/20/fix-for-the-dredded-wordpress-paragraph-spacing-problem/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 02:16:13 +0000</pubDate>
		<dc:creator>Low Frequency</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[line break]]></category>
		<category><![CDATA[p]]></category>
		<category><![CDATA[Paragraph]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[Space]]></category>
		<category><![CDATA[white space]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wpautop]]></category>

		<guid isPermaLink="false">http://lowfrequencyops.com/?p=837</guid>
		<description><![CDATA[This article discusses a fix for Wordpress, a software that this websites uses to manage its content. Really, this is only pertinent to website administrators specifically using Wordpress. Otherwise you might just want to skip it. &#160;
So while making little changes to the LFO website code in Wordpress, something suddenly happened&#8230; The line breaks between [...]]]></description>
			<content:encoded><![CDATA[<p>This article discusses a fix for Wordpress, a software that this websites uses to manage its content. Really, this is only pertinent to website administrators specifically using Wordpress. Otherwise you might just want to skip it.</p> &nbsp;
<p><span id="more-837"></span>So while making little changes to the LFO website code in Wordpress, something suddenly happened&#8230; The line breaks between paragraphs in blog posts and site pages all just disappeared right out of the blue. I was dumbfounded! Upon investigating all the changes to the website code I had made, I was completely unable to figure out what had happened.</p> &nbsp;
<p>I searched the web for the problem and found it was a common issue among Wordpress users (which blows my mind because I feel that WP is nearly infallible). Some people were able to add <strong>&amp;nbsp;</strong> tags in the blank space between paragraphs in the HTML post editor to fix the problem. It worked for me too but I didn&#8217;t really want to have to do that to over 100 different posts and pages. That would suck.</p> &nbsp;
<p>A little research showed me that there is a function in Wordpress located in <em><strong>/wp-includes/formatting.php</strong></em> that is responsible for auto-inserting <strong>&lt;p&gt;</strong> tags in place of line breaks on pages and posts. So I simply added <strong>&amp;nbsp;</strong> tags after every <strong>&lt;/p&gt;</strong> tag in the replace strings of this function and sure enough, it worked!</p> &nbsp;
<p>I cannot guarantee that it is a sound method to use for this problem but it did work for me so I wanted to share the fix with you.</p> &nbsp;
<p>In the latest version of Wordpress, open this file <em><strong>/wp-includes/formatting.php</strong></em> and find the function <strong>wpautop</strong> and replace the entire function with this code:</p> &nbsp;<br />
<blockquote><p>function wpautop($pee, $br = 1) {<br />
if ( trim($pee) === &#8221; )<br />
return &#8221;;<br />
$pee = $pee . &#8220;\n&#8221;; // just to make things a little easier, pad the end<br />
$pee = preg_replace(&#8217;|&lt;br /&gt;\s*&lt;br /&gt;|&#8217;, &#8220;\n\n&#8221;, $pee);<br />
// Space things out a little</p> &nbsp;
<p>$allblocks = &#8216;(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|<br />
dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)&#8217;;<br />
$pee = preg_replace(&#8217;!(&lt;&#8217; . $allblocks . &#8216;[^&gt;]*&gt;)!&#8217;, &#8220;\n$1&#8243;, $pee);<br />
$pee = preg_replace(&#8217;!(&lt;/&#8217; . $allblocks . &#8216;&gt;)!&#8217;, &#8220;$1\n\n&#8221;, $pee);<br />
$pee = str_replace(array(&#8221;\r\n&#8221;, &#8220;\r&#8221;), &#8220;\n&#8221;, $pee); // cross-platform newlines<br />
if ( strpos($pee, &#8216;&lt;object&#8217;) !== false ) {<br />
$pee = preg_replace(&#8217;|\s*&lt;param([^&gt;]*)&gt;\s*|&#8217;, &#8220;&lt;param$1&gt;&#8221;, $pee); // no pee inside object/embed<br />
$pee = preg_replace(&#8217;|\s*&lt;/embed&gt;\s*|&#8217;, &#8216;&lt;/embed&gt;&#8217;, $pee);<br />
}<br />
$pee = preg_replace(&#8221;/\n\n+/&#8221;, &#8220;\n\n&#8221;, $pee); // take care of duplicates<br />
// make paragraphs, including one at the end<br />
$pees = preg_split(&#8217;/\n\s*\n/&#8217;, $pee, -1, PREG_SPLIT_NO_EMPTY);<br />
$pee = &#8221;;<br />
foreach ( $pees as $tinkle )<br />
$pee .= &#8216;&lt;p&gt;&#8217; . trim($tinkle, &#8220;\n&#8221;) . &#8220;&lt;/p&gt;&amp;nbsp;\n&#8221;;<br />
$pee = preg_replace(&#8217;|&lt;p&gt;\s*&lt;/p&gt;&amp;nbsp;|&#8217;, &#8221;, $pee); // under certain strange conditions it could create a P of entirely whitespace<br />
$pee = preg_replace(&#8217;!&lt;p&gt;([^&lt;]+)&lt;/(div|address|form)&gt;!&#8217;, &#8220;&lt;p&gt;$1&lt;/p&gt;&amp;nbsp;&lt;/$2&gt;&#8221;, $pee);<br />
$pee = preg_replace(&#8217;!&lt;p&gt;\s*(&lt;/?&#8217; . $allblocks . &#8216;[^&gt;]*&gt;)\s*&lt;/p&gt;&amp;nbsp;!&#8217;, &#8220;$1&#8243;, $pee); // don&#8217;t pee all over a tag<br />
$pee = preg_replace(&#8221;|&lt;p&gt;(&lt;li.+?)&lt;/p&gt;&amp;nbsp;|&#8221;, &#8220;$1&#8243;, $pee); // problem with nested lists<br />
$pee = preg_replace(&#8217;|&lt;p&gt;&lt;blockquote([^&gt;]*)&gt;|i&#8217;, &#8220;&lt;blockquote$1&gt;&lt;p&gt;&#8221;, $pee);<br />
$pee = str_replace(&#8217;&lt;/blockquote&gt;&lt;/p&gt;&amp;nbsp;&#8217;, &#8216;&lt;/p&gt;&amp;nbsp;&lt;/blockquote&gt;&#8217;, $pee);<br />
$pee = preg_replace(&#8217;!&lt;p&gt;\s*(&lt;/?&#8217; . $allblocks . &#8216;[^&gt;]*&gt;)!&#8217;, &#8220;$1&#8243;, $pee);<br />
$pee = preg_replace(&#8217;!(&lt;/?&#8217; . $allblocks . &#8216;[^&gt;]*&gt;)\s*&lt;/p&gt;&amp;nbsp;!&#8217;, &#8220;$1&#8243;, $pee);<br />
if ($br) {<br />
$pee = preg_replace_callback(&#8217;/&lt;(script|style).*?&lt;\/\\1&gt;/s&#8217;, create_function(&#8217;$matches&#8217;, &#8216;return str_replace(&#8221;\n&#8221;, &#8220;&lt;WPPreserveNewline /&gt;&#8221;, $matches[0]);&#8217;), $pee);<br />
$pee = preg_replace(&#8217;|(?&lt;!&lt;br /&gt;)\s*\n|&#8217;, &#8220;&lt;br /&gt;\n&#8221;, $pee); // optionally make line breaks<br />
$pee = str_replace(&#8217;&lt;WPPreserveNewline /&gt;&#8217;, &#8220;\n&#8221;, $pee);<br />
}<br />
$pee = preg_replace(&#8217;!(&lt;/?&#8217; . $allblocks . &#8216;[^&gt;]*&gt;)\s*&lt;br /&gt;!&#8217;, &#8220;$1&#8243;, $pee);<br />
$pee = preg_replace(&#8217;!&lt;br /&gt;(\s*&lt;/?(?:p|li|div|dl|dd|<br />
dt|th|pre|td|ul|ol)[^&gt;]*&gt;)!&#8217;, &#8216;$1&#8242;, $pee);<br />
if (strpos($pee, &#8216;&lt;pre&#8217;) !== false)<br />
$pee = preg_replace_callback(&#8217;!(&lt;pre[^&gt;]*&gt;)(.*?)&lt;/pre&gt;!is&#8217;, &#8216;clean_pre&#8217;, $pee );<br />
$pee = preg_replace( &#8220;|\n&lt;/p&gt;&amp;nbsp;$|&#8221;, &#8216;&lt;/p&gt;&amp;nbsp;&#8217;, $pee );<br />
$pee = preg_replace(&#8217;/&lt;p&gt;&amp;nbsp;\s*?(&#8217; . get_shortcode_regex() . &#8216;)\s*&lt;\/p&gt;&amp;nbsp;/s&#8217;, &#8216;$1&#8242;, $pee); // don&#8217;t auto-p wrap shortcodes that stand alone</p> &nbsp;
<p>return $pee;<br />
}</p> &nbsp;</blockquote>
<p>Before making any changes described here to your website in any way, PLEASE make a backup of the file you are editing. I cannot be held liable if there is a problem with your website because you tried this fix.</p> &nbsp;<br />
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=Fix+for+the+dredded+Wordpress+paragraph+spacing+problem%21+http://bit.ly/GocNA" title="Post to Twitter"><img class="nothumb" src="http://lowfrequencyops.com/wp-content/plugins/tweet-this/icons/tt-twitter3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://delicious.com/post?url=http://lowfrequencyops.com/2009/10/20/fix-for-the-dredded-wordpress-paragraph-spacing-problem/&amp;title=Fix+for+the+dredded+Wordpress+paragraph+spacing+problem%21" title="Post to Delicious"><img class="nothumb" src="http://lowfrequencyops.com/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://lowfrequencyops.com/2009/10/20/fix-for-the-dredded-wordpress-paragraph-spacing-problem/&amp;title=Fix+for+the+dredded+Wordpress+paragraph+spacing+problem%21" title="Post to Digg"><img class="nothumb" src="http://lowfrequencyops.com/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://lowfrequencyops.com/2009/10/20/fix-for-the-dredded-wordpress-paragraph-spacing-problem/&amp;t=Fix+for+the+dredded+Wordpress+paragraph+spacing+problem%21" title="Share on Facebook"><img class="nothumb" src="http://lowfrequencyops.com/wp-content/plugins/tweet-this/icons/tt-facebook.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://www.myspace.com/Modules/PostTo/Pages/?l=3&amp;u=http://lowfrequencyops.com/2009/10/20/fix-for-the-dredded-wordpress-paragraph-spacing-problem/&amp;t=Fix+for+the+dredded+Wordpress+paragraph+spacing+problem%21&amp;c=%3Cp%3EPowered+by+%3Ca+href%3D%22http%3A%2F%2Frichardxthripp.thripp.com%2Ftweet-this%22%3ETweet+This%3C%2Fa%3E%3C%2Fp%3E" title="Share on MySpace"><img class="nothumb" src="http://lowfrequencyops.com/wp-content/plugins/tweet-this/icons/tt-myspace.png" alt="Post to MySpace" /></a> <a target="_blank" class="tt" href="http://stumbleupon.com/submit?url=http://lowfrequencyops.com/2009/10/20/fix-for-the-dredded-wordpress-paragraph-spacing-problem/&amp;title=Fix+for+the+dredded+Wordpress+paragraph+spacing+problem%21" title="Post to StumbleUpon"><img class="nothumb" src="http://lowfrequencyops.com/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://lowfrequencyops.com/2009/10/20/fix-for-the-dredded-wordpress-paragraph-spacing-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

