<?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>Chris Schuld&#039;s Blog &#187; WordPress</title>
	<atom:link href="http://chrisschuld.com/category/web-development/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrisschuld.com</link>
	<description>personal musings on the composition of software</description>
	<lastBuildDate>Mon, 30 Aug 2010 03:48:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Removing everything BUT Images in a WordPress Post</title>
		<link>http://chrisschuld.com/2009/11/removing-everything-but-images-in-a-wordpress-post/</link>
		<comments>http://chrisschuld.com/2009/11/removing-everything-but-images-in-a-wordpress-post/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 20:58:45 +0000</pubDate>
		<dc:creator>Chris Schuld</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://chrisschuld.com/?p=287</guid>
		<description><![CDATA[A while back I wrote an article on Removing Images from a WordPress Post. Sebastian asked an interesting question; he wanted to remove everything but the images. This is actually pretty straightforward; here is how you do it: &#160; . . . &#60;?php $beforeEachImage = &#34;&#60;div&#62;&#34;; $afterEachImage = &#34;&#60;/div&#62;&#34;; preg_match_all&#40;&#34;/(&#60;img [^&#62;]*&#62;)/&#34;,get_the_content&#40;&#41;,$matches,PREG_PATTERN_ORDER&#41;; for&#40; $i=0; isset&#40;$matches&#91;1&#93;&#41; &#38;&#38; [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I wrote an article on <a href="http://chrisschuld.com/2008/08/removing-images-from-a-wordpress-post/">Removing Images from a WordPress</a> Post.  Sebastian asked an interesting question; he wanted to remove everything but the images.  This is actually pretty straightforward; here is how you do it:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
.
.
.
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
           <span style="color: #000088;">$beforeEachImage</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;&quot;</span><span style="color: #339933;">;</span>
           <span style="color: #000088;">$afterEachImage</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
           <span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/(&lt;img [^&gt;]*&gt;)/&quot;</span><span style="color: #339933;">,</span>get_the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #000088;">$matches</span><span style="color: #339933;">,</span>PREG_PATTERN_ORDER<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                 <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$beforeEachImage</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$afterEachImage</span><span style="color: #339933;">;</span>
           <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
.
.
.</pre></div></div>

<p>Keep in mind this code needs to be in the <a href="http://codex.wordpress.org/The_Loop">WordPress Loop</a> and you can control what is around each image using the variables <strong>beforeEachImage</strong> and <strong>afterEachImage</strong> above.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisschuld.com/2009/11/removing-everything-but-images-in-a-wordpress-post/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Moving a WordPress Install from one Domain (A) to another Domain (B)</title>
		<link>http://chrisschuld.com/2009/10/moving-a-wordpress-install-from-one-domain-a-to-another-domain-b/</link>
		<comments>http://chrisschuld.com/2009/10/moving-a-wordpress-install-from-one-domain-a-to-another-domain-b/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 18:07:22 +0000</pubDate>
		<dc:creator>Chris Schuld</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://chrisschuld.com/?p=266</guid>
		<description><![CDATA[From time to time I had have to move one installation of WordPress from one domain (let&#8217;s call it domain A) to a new domain (let&#8217;s call it domain B). Because WordPress embeds the domain all over the data schema (not faulting; simply disclosing) you have to make a lot of dB changes for the [...]]]></description>
			<content:encoded><![CDATA[<p>From time to time I had have to move one installation of WordPress from one domain (<em>let&#8217;s call it domain A</em>) to a new domain (<em>let&#8217;s call it domain B</em>).  Because WordPress embeds the domain all over the data schema (not faulting; simply disclosing) you have to make a lot of dB changes for the updated site location to function.  Here is the quick and dirty way to move the data:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_content <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post_content<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;[OLD_DOMAIN]&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;[NEW_DOMAIN]&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wp_posts <span style="color: #993333; font-weight: bold;">SET</span> guid <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>guid<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;[OLD_DOMAIN]&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;[NEW_DOMAIN]&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wp_options <span style="color: #993333; font-weight: bold;">SET</span> option_value <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>option_value<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;[OLD_DOMAIN]&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;[NEW_DOMAIN]&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wp_postmeta <span style="color: #993333; font-weight: bold;">SET</span> meta_value <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>meta_value<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;[OLD_DOMAIN]&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;[NEW_DOMAIN]&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Finally, for the final bit of trickery if you are using <a href="http://wordpress.org/extend/plugins/wp-super-cache/">Advanced Caching</a> on the site there is a great place where the localized PATH is hard coded.  Edit your new and updated path on file <strong>advanced-cache.php</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> wp-content<span style="color: #000000; font-weight: bold;">/</span>advanced-cache.php</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://chrisschuld.com/2009/10/moving-a-wordpress-install-from-one-domain-a-to-another-domain-b/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Removing Images in a WordPress Post (Revisited)</title>
		<link>http://chrisschuld.com/2009/04/removing-images-in-a-wordpress-post-revisited/</link>
		<comments>http://chrisschuld.com/2009/04/removing-images-in-a-wordpress-post-revisited/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 06:17:47 +0000</pubDate>
		<dc:creator>Chris Schuld</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://chrisschuld.com/?p=230</guid>
		<description><![CDATA[A while back I wrote a semi-popular post on removing images from a WordPress post &#8212; today I am revisiting it. The original solution used the_content() and the output buffer to remove the images out of the post. Now that I have used WordPress a bit longer and candidly had to use the solution again [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I wrote a semi-popular post on <a href="http://chrisschuld.com/2008/08/removing-images-from-a-wordpress-post/">removing images from a WordPress post</a> &#8212; today I am revisiting it.  The original solution used <a href="http://codex.wordpress.org/Template_Tags/the_content">the_content()</a> and the <a href="http://us2.php.net/outcontrol">output buffer</a> to remove the images out of the post.  Now that I have used <a href="http://wordpress.org/">WordPress</a> a bit longer and candidly had to use the solution again and thought &#8220;<em>what was I thinking</em>&#8221; I thought I would share the cleaner solution:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&amp;lt;img[^&amp;gt;]+./'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>get_the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://chrisschuld.com/2009/04/removing-images-in-a-wordpress-post-revisited/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Removing Images from a WordPress Post</title>
		<link>http://chrisschuld.com/2008/08/removing-images-from-a-wordpress-post/</link>
		<comments>http://chrisschuld.com/2008/08/removing-images-from-a-wordpress-post/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 21:58:35 +0000</pubDate>
		<dc:creator>Chris Schuld</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://chrisschuld.com/?p=47</guid>
		<description><![CDATA[Today I ran across a unique need to remove images from a WordPress post in a specific post loop.  Because there is no way to do a &#8220;read more&#8221; excerpt while taking strict control of the raw content from the_content() I was limited to capturing and manipulating the content from PHP&#8217;s output buffer.  My solution: [...]]]></description>
			<content:encoded><![CDATA[<p>Today I ran across a unique need to remove images from a WordPress post in a specific post loop.  Because there is no way to do a &#8220;<em>read more</em>&#8221; excerpt while taking strict control of the raw content from <strong>the_content()</strong> I was limited to capturing and manipulating the content from PHP&#8217;s output buffer.  My solution: obtain the output from the_content() and remove the image tags from the post using preg_replace().</p>
<p>Here is the solution:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">.
.
.
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
   <span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Read the full post'</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000088;">$postOutput</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;img[^&gt;]+./'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #990000;">ob_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #990000;">ob_end_clean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$postOutput</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
.
.
.</pre></div></div>

<p><strong>EDIT</strong>: make sure you check out the <a href="http://chrisschuld.com/2009/04/removing-images-in-a-wordpress-post-revisited/">updated version of this solution</a>.  Also, view my solution for <a href="http://chrisschuld.com/2009/11/removing-everything-but-images-in-a-wordpress-post/">removing everything but the images</a>.<br />
<br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://chrisschuld.com/2008/08/removing-images-from-a-wordpress-post/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>
