Magento WordPress Integration – How To Enable WordPress Posts On Your Magento Homepage

When it comes to integrating WordPress with Magento, one of our favorite modules to work with is Fishpig’s excellent and free “Magento WordPress Integration” module….
  • Joel Holtzman
  • Magento Development Lead
  • April 24, 2014 Estimated reading time: 5 minutes

When it comes to integrating WordPress with Magento, one of our favorite modules to work with is Fishpig’s excellent and free “Magento WordPress Integration” module. You can learn more about it and, if you choose to, install it yourself by clicking here. For the sake of this tutorial, and for your own benefit, I strongly recommend paying for their professional installation as the installation is tricky and it is beyond the scope of this article.

What This Module Can Do For You

If you have a WordPress site already set up then you know the importance of keeping your visitors informed and interacting with them. Unfortunately, many WordPress users find themselves wanting to sell items online but they are not always happy with the e-commerce solutions available on WordPress. Similarly, there are many Magento users who love running their store through Magento but are not happy with the fact that Magento does not include a ‘blog module’ to allow you easy set up of posts. With The  Magento/Wordpress Integration module, you can take your existing wordpress blog and integrate it into your existing Magento site including using the existing Magento theme. Here are a few examples:

Tracking Dog Supply

The screenshot shows the 4 posts that load on the homepage. Click the link to see it in action and see how it integrates into the website.

Kombucha Brooklyn

This is one of the other sites we developed that integrates WordPress and Magento integration. We customized the module template file that loads the posts from WordPress to ensure it has the look and feel, for each post, that they wanted.

If you need help with your Magento store, call 845-656-3000 or Contact us here »

What Features Are Available? Does It Filter By Category/Recent Posts?

The great thing about this integration module is that you can enter ‘short code’ into your homepage CMS page that will let you determine the number of posts to show, the category of posts you want to load and the header text that sits above the posts. For instance, on a demo site, I created a category on my WordPress blog called ‘tips’ and replaced the default ‘latest news’ headline with “Latest Tips” just by using this short code:

The Original Default Shortcode The Fishgpig Module Recommends You Use:

{{block type=”wordpress/sidebar_widget_posts” name=”wordpress.widget.recent_posts” post_count=”4″ title=”Latest Posts” date=”off” comment_num=”off” template=”wordpress/sidebar/widget/posts_old.phtml”}}

If you place that code in the CMS block of your homepage it will load 4 of your most recent posts, regardless of category, and have a headline label at the top of them titled “Latest Posts”.

The screenshots shows you the result of the short code. You have 4 posts showing the title, not content, and they will link to the post page of your blog which will be integrated with your Magento theme. Now, let’s take a look at what happens when you change the header title “Latest News” to “Latest Tips” and assign a specific category to filter through. In my demo site I have a WordPress category titled “Tips” with a category id of 2. You can find your category id by logging into your WordPress admin, clicking on ‘categories’ under the “Posts” section of the left nav. Then click on the category name. When you are on the category edit page, look at the url at the top of your browser and you will see a query string (see screenshot – note the part of the url that is highlighted)

That number, 2, tells me the ‘tips’ category has an ID of 2. If you see a 4 in that url with the “tag_ID” parameter, then your category ID for that category is 4. With that in mind, here is how I am able to tell Magento’s homepage to load 4 posts from the “Tips” category and make the header title “Latest Tips” instead of “Latest News”:

{{block type=”wordpress/sidebar_widget_posts” name=”wordpress.widget.recent_posts” post_count=”4″ category_id=”2″ title=”Latest Tips” date=”off” comment_num=”off” template=”wordpress/sidebar/widget/posts.phtml”}}

If you have a category with an ID of 2, and assign 4 posts to it in WordPress, and then go back to your homepage (I suggest you test this with a test CMS page in Magento, first) and add that code, you will see something like this:

Conclusion

While you may have to pay for the install service if you are not familiar with configuring modules, the module is free and is well worth it even with the set up because you can save so much time in avoiding what is a tricky setup. When you are up and running with this module, you will find it incredibly convenient and flexible because you can load posts through any category, or through all categories by default, and you can determine how many posts are displayed. You can load the ‘short code’ in any CMS page you want and you are free to style/format the templates that display the posts any way you want. What I usually do for clients is alter the post display template so the format of posts fits their design needs and allow ‘exerpts’ to load, which is a teaser of the content of the post being displayed. Kombucha Brooklyn is a perfect example of this. You will notice we load the title, an ‘excerpt’ and then offer a ‘read more’ link. If you would like to have this module installed, or even modified to your needs, feel free to contact us and tell us what you are looking to accomplish with Magento and WordPress.

For more information about Magento, contact us at 845-656-3000 or Get a Quote »

Related Services