How to Integrate WordPress Blog with Magento 2 Store

Home >> Blog >> Wordpess >> How to Integrate WordPress Blog with Magento 2 Store
How to Integrate WordPress Blog with Magento 2 Store

We all know that Magento is the best platform for eCommerce and WordPress is best for blogging.

If you already have an user friendly Magento eCommerce website and want to boost SEO for your product keywords in order to achieve top search rank, integrating a wordpress blog with Magento is the best way. Any professional seo service provider will advise you the same.

Your next question would be, Is that possible to integrate your wordpress blog with your Magento website? The answer is yes and it’s not that difficult.

In this article we have provided step by step guide on how to integrate WordPress blog with your Magento 2 store.

Magento WordPress Integration

First we need to download the extension and use it for making connection between Magento and WordPress.

We will be using free extension of FishPig Magento WordPress Integration downloadable from here which has good features to connect Magento and WordPress.

Once the archive is downloaded, go to your Magento root directory and you need to extract the files from archive there. After the extraction it will show like below:

Magento WordPress Integration

After that you need to enable the extension and clear the cache so that the blog integration is available on your Magento store to use.

Have a project in mind?

Lets talk about it

Request a Quote

For this you have to run commands from terminal using SSH access. Login to your Magento store SSH account and go to Magento root directory and run below commands:

php bin/magento module:enable FishPig_WordPress
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:clean
php bin/magento cache:flush

Once finished executing these commands successfully, you need to go to your Magento store admin configuration to Enable the Blog link and set path of your WordPress installation directory.

Go to Admin -> Store -> WORDPRESS

Magento store admin configuration

Make sure that the path of your WordPress installation is relative to your Magento root.

WordPress Setup

Next step for your WordPress blog integration with Magento 2 is to ensure that correct settings are applied in your WordPress to link the Magento 2 integration.

Also, your WordPress blog should be installed and working under the sub-directory of your Magento 2 root directory which you have entered in above step.

Go to your WordPress Admin -> Settings -> General. In here you need to update the Site Address to “/blog” so that WordPress front pages can be accessed with that URL.

WordPress Setup

Now save the changes and you can check your integration of WordPress blog with Magento 2 is complete.

Go to your Magento 2 store URL and add “/blog” in there to open your WordPress blog in your Magento store. Discuss with our WordPress developers if you are facing any issues.

WordPress blog in your Magento store

Display Recent WordPress Posts in Magento 2

You can easily show a list of your recent blog posts to your Magento 2 site by using the code below.

This code will generate a collection of the 5 recent posts of your blog and loop through them to show those.

Here’s a simple example which uses the object manager:

<?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance() ?>
<?php $posts = objectManager->create(‘FishPig\WordPress\Model\ResourceModel\Post\Collection’)
->load(); ?>
<?php if (count($posts) > 0): ?>
<?php foreach($posts as $post): ?>
<a href=<?php echo $post->getUrl() ?>><?php echo $this->escapeHtml($post->getName()) ?></a>
<?php if ($image = $post->getFeaturedImage()): ?>
<a href=<?php echo $post->getUrl() ?>>
<img src=<?php echo $image->getAvailableImage() ?> src=<?php echo $this->escapeHtml($post->getName()) ?> />
<?php endif; ?>
<p><?php echo $post->getPostExcerpt(40) ?></p></li>
<?php endforeach; ?>
<?php endif; ?>

Content marketing is the best way to boost your organic search rank and a blog on your eCommerce website will help you to share useful content about your products with your customers. Review our another post on why it is important to have a blog on your ecommerce website.

Still have any questions? Please write in the comment section below and our Magento 2 experts would be happy to help.


Bhavin M

Bhavin M, co-founder of Icecube Digital, spends much of his time creating simple but valuable content which helps ecommerce entrepreneurs to grow their online business.

Get Free Quote Now

Send us your project notes