<?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>Magento design, development and suport :: sonassi &#187; lazzymonk wordpress</title>
	<atom:link href="http://www.sonassi.com/tag/lazzymonk-wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sonassi.com</link>
	<description>Latest press releases, tutorials and thoughts on the world can be found here</description>
	<lastBuildDate>Wed, 18 Jan 2012 14:06:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>WordPress and Magento integration extension</title>
		<link>http://www.sonassi.com/knowledge-base/magento-knowledge-base/wordpress-and-magento-integration-extension/</link>
		<comments>http://www.sonassi.com/knowledge-base/magento-knowledge-base/wordpress-and-magento-integration-extension/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 21:13:21 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[lazzymonk wordpress]]></category>
		<category><![CDATA[magento and wordpress]]></category>
		<category><![CDATA[magento breadcrumbs]]></category>
		<category><![CDATA[magento cms]]></category>
		<category><![CDATA[magento wordpress integration]]></category>
		<category><![CDATA[seo magento]]></category>
		<category><![CDATA[seo wordpress magento]]></category>
		<category><![CDATA[sonassi_wordpress extension]]></category>
		<category><![CDATA[sonassi_wordpress module]]></category>
		<category><![CDATA[speed up admin magento]]></category>
		<category><![CDATA[wordpress and magento]]></category>
		<category><![CDATA[wordpress cms magento]]></category>
		<category><![CDATA[wordpress extension]]></category>
		<category><![CDATA[wordpress integration for magento]]></category>
		<category><![CDATA[wordpress magento extension]]></category>
		<category><![CDATA[wordpress magento integration]]></category>
		<category><![CDATA[wordpress magento plugin]]></category>
		<guid isPermaLink="false">http://www.sonassi.com/?p=1279</guid>
		<description><![CDATA[Try WordPress Deluxe for a fully integrated solution for Magento CE and EE You can now obtain a copy of the Magento WordPress Deluxe Extension. Our store isn’t live yet, so we are taking orders via email at the moment. &#8230; <a href="http://www.sonassi.com/knowledge-base/magento-knowledge-base/wordpress-and-magento-integration-extension/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="mag_alert" style="border-bottom:1px dotted #777;">
<p><a href="http://www.sonassi.com/knowledge-base/magento-knowledge-base/magento-wordpress-deluxe-extension/" title="Wordpress Deluxe"><img height="291" width="291" class="left size-full wp-image-1609" title="Wordpress Deluxe" alt="Wordpress Deluxe" src="http://www.sonassi.com/wp-content/uploads/2010/09/wordpress_box.png"></a></p>
<h3 style="clear:none !important">Try WordPress Deluxe for a fully integrated solution for Magento CE and EE</h3>
<p>You can now obtain a copy of the Magento WordPress Deluxe Extension. Our store isn’t live yet, so we are taking orders via email at the moment.</p>
<p><strong>The price is £100 including free installation (theming is not included).</strong></p>
<p>Buy <a href="http://www.sonassi.com/knowledge-base/magento-knowledge-base/magento-wordpress-deluxe-extension/" title="Wordpress Deluxe">WordPress Deluxe</a> now!</p>
<p><br class="clear" />
</div>
<p><br class="clear" /></p>
<h3>Otherwise, here&#8217;s the old free version</h3>
<p>We&#8217;re not trying to re-invent the wheel here, nor are we going into any depth of connecting the authentication modules. From a front-end standpoint, the two &#8220;elements&#8221; <em>wordpress</em> and <em>magento</em> are essentially one &#8211; but all administration is carried out via either separate admin. With this extension, it is easy to facilitate your <em>magento wordpress integration</em>.</p>
<p>Where our solution works better than the others (<a href="http://www.magentocommerce.com/extension/296/lazzymonks-wordpress-integration" title="Lazzymonks">Lazzymonks</a> or <a href="http://activecodeline.com/wordpress-and-magento-integration-one-way-to-go" title="ActiveCodeline">ActiveCodeline</a>), it actually allows the clean <em>search engine optimised</em> URL&#8217;s from WordPress to be used in Magento&#8217;s breadcrumbs and address bar. It also takes advantage of Magento&#8217;s standard caching functionality, so the speed is very impressive. We also integrated the &#8220;Pages&#8221; listing in the sidebar with that of the Magento CMS, so you can use WordPress for posts and still retain the Magento CMS for pages.</p>
<p>Combining <em>Magento and WordPress</em> provides a big thumbs up for SEO, ease of use and performance.</p>
<h3>So why use the WordPress Magento extension?</h3>
<ul>
<li>Includes breadcrumbs</li>
<li>Supports SEO Urls</li>
<li>Supports META tags</li>
<li>It is free! (we can also install it for you for a small fee)</li>
<li>It comes with a feed widget for both comments and posts <strong>*new</strong></li>
<li>Now integrates Magento user&#8217;s profile for posting comments <strong>*new</strong></li>
</ul>
<h3>Installation</h3>
<p>Installation might not be that straightforward as we developed it purely for a quick and clever <em>wordpress / magento intergration</em>, so we&#8217;ll try to explain as best we can!</p>
<p><strong>This was tested and used with WordPress 2.8 with Magento 1.3.2.4 and WordPress 2.8 with Magento 1.4.0.0 at the time of writing</strong></p>
<p><strong>Current version: 1.2.1</strong></p>
<ul class="opti optinoheight">
<li>
  <span class="yes">1</span><br />
  <br />
   First, download the files that you need<br />
  <a href="http://www.sonassi.com/wp-content/uploads/2010/01/Sonassi_Wordpress_Module.tar.gz" title="Sonassi_Wordpress_Module.tar.gz"><img alt="" src="/images/icon-zip.png"> Sonassi_Wordpress_Module.tar.gz</a><br />
  <a href="http://www.sonassi.com/wp-content/uploads/2010/01/Sonassi_Wordpress_Theme.tar.gz" title="Sonassi_Wordpress_Theme.tar.gz"><img alt="" src="/images/icon-zip.png"> Sonassi_Wordpress_Theme.tar.gz</a><br />
  <a href="http://www.sonassi.com/wp-content/uploads/2010/01/Sonassi_Wordpress_MagentoTheme.tar.gz" title="Sonassi_Wordpress_MagentoTheme.tar.gz"><img alt="" src="/images/icon-zip.png"> Sonassi_Wordpress_MagentoTheme.tar.gz</a><br />
  <a href="http://www.sonassi.com/wp-content/uploads/2010/01/Wordpress.xml.tgz" title="Wordpress.xml.tgz"><img alt="" src="/images/icon-zip.png">WordPress.xml.tgz</a><br />
  <a href="http://www.sonassi.com/wp-content/uploads/2010/01/Generate_htaccess.tar.gz" title="Generate_htaccess.tar.gz"><img alt="" src="/images/icon-zip.png">Generate_htaccess.tar.gz</a>
</li>
<li>
  <span class="yes">2</span><br />
  <br />
  Make a new directory <strong>./app/code/local/Sonassi</strong> then install the <strong>Sonassi_Wordpress_Module.tar.gz</strong> by extracting the tar file, then put the directory <strong>&#8220;WordPress&#8221;</strong> in to a new folder <strong>./app/code/local/Sonassi</strong>.
</li>
<li>
  <span class="yes">3</span><br />
  <br />
   Download and install the latest version of WordPress from <a href="http://wordpress.org/latest.zip" title="http://wordpress.org/latest.zip">http://wordpress.org/latest.zip</a>. Extract to <strong>./blog</strong> (you can also change this, but you will need to change the <strong>blog</strong> reference throughout) and <a href="http://codex.wordpress.org/Installing_WordPress" title="Install WordPress">install WordPress</a> as normal.
</li>
<li>
  <span class="yes">4</span><br />
  <br />
   Extract <strong>Sonassi_Wordpress_Theme.tar.gz</strong> into the <strong>./blog/wp-content/themes</strong> directory and select the <em>Magento WordPress 1.0 by Sonassi</em> as the active theme.<br />
  <br />
  In <strong>Settings > Permalinks</strong> set custom structure with <strong>/%category%/%year%/%monthnum%/%postname%/</strong> for SEO.
</li>
<li>
  <span class="yes">5</span><br />
  </p>
<p class="mag_alert">
As people seem to be having difficulty identifying their server&#8217;s outbound IP address &#8211; we have put together a script to automatically create both .htaccess files &#8211; or amend as necessary. Download <code>Generate_htaccess.tar.gz</code> into your WordPress directory (<code>/blog</code>), then visit your website http://www.example.com/blog/generate_htaccess.php. This should automatically perform steps 5 and 6 for you.
</p>
<p>  Edit <strong>./blog/.htaccess</strong> and add the following information at the start, replace the XXX section with the outbound IP address of your server. This is to prevent the un-styled raw pages from WordPress ever being displayed or indexed.</p>
<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /blog/
&nbsp;
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/blog/wp-admin
RewriteCond %{REQUEST_URI} !^/blog/wp-content
RewriteCond %{REQUEST_URI} ^/blog
RewriteCond %{REMOTE_ADDR} !^XXX\.XXX\.XXX\.XXX
RewriteRule .* ../index.php [L]
&lt;/IfModule&gt;
&nbsp;
# BEGIN WordPress
&nbsp;
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
&lt;/IfModule&gt;
&nbsp;
# END WordPress</pre></div></div>
</li>
<li>
  <span class="yes">6</span><br />
  <br />
  Update your <strong>./htaccess</strong> to allow WordPress to work, add this just beneath <strong>RewriteBase /</strong><br />
  </p>
<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">############################################
## sonassi.com wordpress extension
##
&nbsp;
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/blog/wp-admin
    RewriteCond %{REQUEST_URI} !^/blog/wp-content
    RewriteCond %{REQUEST_URI} ^/blog
    RewriteCond %{REMOTE_ADDR} !^XXX\.XXX\.XXX\.XXX
    RewriteRule .* index.php [L]</pre></div></div>
</li>
<li>
  <span class="yes">7</span><br />
  <br />
  Extract <strong>Sonassi_Wordpress_MagentoTheme.tar.gz</strong> to <strong>./app/design/frontend/default/default/template</strong> . We deliberately left these files almost empty &#8211; so you can customise them to your needs. </p>
<p>Extract <strong>WordPress.xml.tgz</strong> to <strong>./app/design/frontend/default/default/layout</strong>. This file contains the XML for the extension, it has a default handle of <strong>blog_default</strong> that is applied to every page, this can be adjusted to suit your desired look.
</li>
<li>
  <span class="yes">8</span><br />
  <br />
  Create a new file <strong>./app/etc/modules/Sonassi_All.xml</strong> to enable the WordPress module</p>
<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Sonassi_Wordpress<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;active<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/active<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;codePool<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>local<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/codePool<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Sonassi_Wordpress<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>
</li>
</ul>
<p><br class="clear" /></p>
<p>That should be it, add some example posts, then visit your news on the front end via www.YOURDOMAIN.com/blog/ . We must stress that this <em>Magento wordpress extension</em> was never designed for mass installation &#8211; it was a quick one off for a customer that turned out to rival (if not better) the alternatives out there.</p>
<p>We&#8217;ve set up an example at <a href="http://demo.sonassi.com/blog/" title="http://demo.sonassi.com/blog/">http://demo.sonassi.com/blog/</a> &#8211; from following the directions above, we haven&#8217;t themed any element of it so you can see how it will look from the onset.</p>
<h3>What&#8217;s going on, I keep getting redirected to the 404 page</h3>
<p class="mag_alert">*This only applies to version 1.1 or lower</p>
<p>On around line 163 of <code>./app/code/local/Sonassi/Wordpress/Page.php</code>, there is a call to grab the current store code. We liberally assumed that &#8220;default&#8221; would be your default store name, if it isn&#8217;t, then it will cause 404 redirect errors.</p>
<p>Simply change it to,</p>
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$store</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">app</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStore</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>
<h3>allow_url_fopen is disabled</h3>
<p>In this case, you will need to replace the function <code>getPage()</code> in <code>Model/Page.php</code> with the cURL alternative.</p>
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getPage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
&nbsp;
      <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getBaseUrl</span><span style="color: #009900;">&#40;</span>Mage_Core_Model_Store<span style="color: #339933;">::</span><span style="color: #004000;">URL_TYPE_WEB</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;//blog&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;/blog&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_FAILONERROR<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: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<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: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_FORBID_REUSE<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: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_MAXCONNECTS<span style="color: #339933;">,</span> <span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_MAXREDIRS<span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_TIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$content_curl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$response_curl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_getinfo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #990000;">curl_close</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$response_curl</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'header_size'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$response_curl</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'content_type'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
          <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;text/html&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;application/x-httpd-php&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
                 <span style="color: #339933;">||</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;text/xml&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$content_curl</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$response_curl</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$header</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$header</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
              <span style="color: #009900;">&#125;</span>
              <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$content_curl</span><span style="color: #339933;">;</span>
              <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;text/xml&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$content_curl</span><span style="color: #339933;">;</span>
              <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
              <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: /no-route&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
              <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
          <span style="color: #009900;">&#125;</span>
&nbsp;
          <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">buffer</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$content_curl</span><span style="color: #339933;">;</span>
&nbsp;
          <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">buffer</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: /blog/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>
<h3>I&#8217;m stuck in a redirect loop</h3>
<p>This is caused by either two things, incorrect request URL or the content-type being mis-read. Edit <code>Model/Page.php</code> and add the following lines instead:</p>
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getBaseUrl</span><span style="color: #009900;">&#40;</span>Mage_Core_Model_Store<span style="color: #339933;">::</span><span style="color: #004000;">URL_TYPE_WEB</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">+</span> <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;//blog&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;/blog&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #666666; font-style: italic;">//$type = end($http_response_header);</span>
 <span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$http_response_header</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$headerVal</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$headerVal</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Content-Type'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
   <span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$headerVal</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>
<h3>But I want to change the URL</h3>
<p>That can easily be done by changing the following files:</p>
<p>In <code>.htaccess</code> change all blog > news.<br />
In <code>blog/.htaccess</code> change all blog > news.<br />
In <code>app/code/local/Sonassi/Wordpress/etc/config.xml</code> change blog > news.<br />
In <code>app/code/local/Sonassi/wordpress/Model/Page.php</code> change blog > news.<br />
In <code>blog/wp-config.php</code>, add</p>
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_HOME'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'http://example.com/news'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_SITEURL'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'http://example.com/news'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>
<h3>I&#8217;d also like to incorporate the WordPress feeds on my site!</h3>
<p>Then you should read our guide on <a href="http://www.sonassi.com/knowledge-base/magento-knowledge-base/easily-integrate-wordpress-feeds-in-magento/" title="Wordpress feed integration for Magento">WordPress feed integration for Magento</a>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sonassi.com/knowledge-base/magento-knowledge-base/wordpress-and-magento-integration-extension/feed/</wfw:commentRss>
		<slash:comments>259</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk (enhanced)
Database Caching 31/35 queries in 0.027 seconds using disk
Object Caching 2654/2657 objects using disk

Served from: www.sonassi.com @ 2012-02-10 16:03:37 -->
