If you haven't already installed WordPress, check out our guide to installing WordPress for Magento WordPress Integration.
With WordPress installed, let's get started installing Magento WordPress Integration.
Installing the Extension
The extension is completely free and can be installed like any other Magento extension. Before installing though, ensure that the Magento cache is fully disabled and that the Magento compiler (if it's enabled), is disabled. You can refresh and recompile these after the installation.
For more details on the installing the Magento WordPress Integration extension, see our guide on installing Magento extensions.
Configuring Magento WordPress Integration
With the extension installed, let's configure it so that it connects to WordPress and integrates your WordPress blog into your Magento theme. Login to your Magento Admin and select WordPress > Settings from the top navigation. Once the configuration page loads, there are 2 sections that we need to look at: Database and Integration. Before configuring these sections, I just want to point out that if you have any error/warning messages then that's fine as the configuration changes we are about to make will fix those.
To connect to your WordPress database, the Magento WordPress Integration extension will need to know the connection details. If you installed WordPress in the same database as Magento, this easy and you can simply select 'Yes' for the 'Do Magento and WordPress share a database?' option and enter your table prefix. If WordPress is installed in a different database or if you just aren't sure, you can find your WordPress details in the wp-config.php file that lives inside your WordPress installation. If you installed WordPress at /wp/, this file will be at /wp/wp-config.php. If you can't find this file, ensure that you have installed WordPress.
Once you have your WordPress database details entered correctly, press the 'Save Config' button. After the page loads, some of the error/warning messages that were displayed should now be gone.
There are 3 key fields in this section that we need to go through to get Magento properly integrated: Integrate Theme, Home URL and Path.
For 99.9% of users, this should be set to 'Yes'. This means that you want your WordPress blog to be integrated into your Magento theme. If you set this to 'No', WordPress will not be integrated into Magento and the extension will simply connect to your WordPress database and do nothing else. To simplify things, just set this to 'Yes'.
In this field, what ever you entered will be added to your Magento base URL and become the URL that your integrated WordPress blog is visible on. In this tutorial, I am going to setup my WordPress blog to be integrated at /blog/ and will use this throughout the tutorial. If you want to set your integrated blog up at a different location (eg. /news/ or /articles/) then simply substitue where ever I write 'blog' for what ever you choose to use.
When entering the value in this field, you do not need to enter the trailing or initial '/' character. Using the blog example, you would simply enter 'blog'.
Finally, the Path field should contain the path to your WordPress installation. This can be the absolute path (starts with a '/' character) or a relative path. If you have installed WordPress in a sub-directory, you can simply enter the name of that sub-directory into this field. As an example, if you installed WordPress in a sub-directory called 'wp', simply enter 'wp' in this field.
Click the 'Save Config' button and wait for the page to reload. You will most likely still have some yellow warning messages at the top of the page (don't worry, we'll take care of those in a minute) but your WordPress blog should now be integrated into Magento. To test this, go to the URL you setup to be your integrated blog URL (remember, this is your Magento base URL and what ever value you entered in the Home URL field). Using the 'blog' example, this would be http://www.example.com/blog/.
Configuring WordPress for Magento Integration
Now let's fix those remaining warnings that sit at the top of the configuration section of the extension in the Magento Admin. To do this, we will need to make some configuration changes in WordPress. To do this, first login to your WordPress Admin. To do this, add 'wp-admin' to what ever your WordPress URL is (eg. http://www.example.com/wp/wp-admin/) and login with the username and password you created while installing WordPress.
Just like Magento, WordPress stores the URLs that it is configured to use in it's database. These URLs live in the 'options' database table (if your table prefix is 'wp_', this table would be 'wp_options') and have the keys 'siteurl' and 'home'. To edit these, select Settings > General from the WordPress Admin navigation. Let's explain what each URL does and what it should be set as for a proper integration.
WordPress Address URL (siteurl)
On the Settings > General page of the WordPress Admin, you should see two input fields that contain URLs. The first URL is labelled the 'WordPress Address URL' and is stored in the 'options' table with the key 'siteurl'. This URL is the URL that WordPress is installed on and should not be changed. If Magento is installed at http://www.example.com/ and WordPress is installed in a sub-directory called 'wp', this URL should be 'http://www.example.com/wp'. Ensure that if Magento is installed with 'www.' in it's URL that this URL also contains 'www.'. If Magento does not have 'www.' in it's URL, ensure this URL also does not contain 'www.'.
Site Address URL (home)
This URL is the second URL on the Settings > General page and contains the URL that the frontend of your blog be will available on. In a normal WordPress installation, this URL would match the WordPress Address URL (the first URL on the Settings > Page), however with an integrated WordPress installation, this URL should be your Magento base URL and then what ever you entered in the Home URL field while configuring Magento WordPress Integration. Using the example I used earlier, if Magento is installed on http://www.example.com/ and your Home URL value in the extension's configuration was 'blog', this URL should be 'http://www.example.com/blog'. As with the WordPress Address URL, ensure that if Magento has a 'www.' in it's URL, this URL also has a 'www.' and if Magento doesn't have a 'www.', this URL also doesn't have a 'www.'.
When WordPress is integrated into Magento, your Magento theme is used to display your blog, which means your WordPress theme isn't used for much. While developing and testing Magento WordPress Integration, I use the Twenty Twelve theme for WordPress. While it doesn't affect the frontend of your blog (remember, the integration uses your Magento theme to display the blog), it does have a small impact on a few integration features so it is highly recommended that you install the Twenty Twelve theme. To do this, select Appearance > Themes > Add New from your WordPress Admin and search for and install the Twenty Twelve theme.
WordPress uses ugly links for blog posts by default but this can be changed really easily and should be changed. To do this, select Settings > Permalinks from the WordPress Admin and select the Permalink structure that is right for you.
If you go to your integrated blog URL and you don't see the blog, check whether you have a CMS Page or Category setup to use 'blog' (or whatever you tried to display your blog on) as it's URL Key. If it does, delete it and the blog should display correctly.
If the blog still isn't displaying, check whether you have the AheadWorks Blog (AW_Blog) module installed. AheadWorks have created this extension using 'blog' as the internal frontName for their extension, which means that when installed, it's not possible to integrate WordPress on /blog/. To resolve this, either delete the AW_Blog extension or integrate WordPress at a different location.