22

I am looking for the best way to integrate WordPress inside of Magento.

First I would like WordPress to use the Header and Footer of Magento.

Second, I would like it to be possible for a user to search on Magento, and WordPress at the same time. And not be stuck. Having to search input.

14

It depends. You've choice :

If you use the Fishpig module (which is a good module) you can use http://www.magentocommerce.com/magento-connect/mage-wordpress-integrated-search-4394.html

The latest solution is to develop your own WordPress integration on Magento :)

  • Yah... I am in trouble. I only have a week. :\ – jnbdz Aug 26 '13 at 7:33
  • My problem with this Fichpig's module is that I am not sure it works for a multi-languages WordPress blog. So I am not sure it will work with this: codex.wordpress.org/Create_A_Network – jnbdz Aug 26 '13 at 7:53
  • You can use WordPress Multisites and integrate them into Magento with the FishPig Multisite extension - fishpig.co.uk/magento/wordpress-integration/multisite – Ben Tideswell Nov 3 '13 at 17:18
  • Is there any module through which I can integrate wordpress in such a way that my store customers can comment on a forum created by wordpress without login to wordpress ? – Jnanaranjan May 11 '15 at 6:41
24

I've used the Fishpig module on a load of sites, have bought the paid for plugins and have been happily promoting it for years. However, I am not using it any more. It does what it does well, but what it does is run everything through Magento.

Let's face it, the client takes one look at a Wordpress site and suddenly starts getting creative. 'We can do this in Wordpress!', 'We can do that in the Wordpress install!'. You have to keep explaining to them that normally, yes that is easy to do in Wordpress....but that their Wordpress installation isn't normal as it is all running through the Magento itself and that changes everything.

So your bank of custom Wordpress widgets won't work, 3rd party Wordpress plugins won't work. Themes and theme options won't work. Unless you do a load of work converting and assimilating them into the Fishpig module.

A much better approach in my opinion is to go the way of James Kemp (http://wordpress.org/plugins/magento-wordpress-integration/) or Richard Feraro (http://wordpress.org/plugins/mage-enabler/). They both take the same approach, allowing you to access the Mage object from Wordpress and pull whatever you want from Magento into your Wordpress theme. If you look at the plugins though, they are very simple and don't involve much code.

They both require a modification to app/code/local/Mage/Core/functions.php as both Wordpress and Magento have a function __() method declared. There are detailed notes about it on both plugin authors sites though and it is very easy. After that you can get stuck in.

It's so simple, here's an example using the James Kemp plugin. You can have a stripped down Wordpress theme with a header.php like;

<!DOCTYPE html>
<html class="no-js">
<head>
    <?php the_block("head"); ?>
    <?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

Which pulls your whole Magento head block into the Wordpress header. Perfect, no duplication, no additional work. Note I added wp_head() because if you add in Wordpress plugins they'll potentially use that as a hook and it's good practice to have that in your Wordpress header.php file.

Same goes for footer.php;

    <?php the_block("footer"); ?>
    <?php wp_footer(); ?>

  </body>
</html>

And there's your Magento footer block in Wordpress. The rest is up to you but you've got the freedom to add as much additional stuff into your Wordpress install as you like without any constraints.

Edit - May 14

Since I wrote this I've also started using Wordpress as the CMS and pulling data back into Magento using this Wordpress plugin - JSON API plugin http://wordpress.org/plugins/json-api/

To give you a code example - the code below pulls the requisite entries in Wordpress for a custom post type called event, accesses a custom field in those posts called eventdate puts them all in an array, sorts it by date and outputs a list of all the events with a link to each event page in Wordpress install. I've used it in the main navigation of a Magento site in a dropdown, it works really well. Wordpress is due to have a JSON API added to the core but as of yet it's not been released.

<ul>
    <?php 

    $events = json_decode(file_get_contents('http://www.example.com/blog/?json=get_posts&post_type=event'));

    $eventList = array();

    foreach ( $events->posts as $event_item ) :

        $arrayDate = date("ymdHi", strtotime($event_item->custom_fields->eventdate[0] ));

        $eventList[$arrayDate]['Title'] = $event_item->title;
        $eventList[$arrayDate]['Date'] = date('l jS F', strtotime($event_item->custom_fields->eventdate[0] ));
        $eventList[$arrayDate]['Link'] = $event_item->url;


    endforeach; 

    // Key reverse sort to get events in date order
    ksort($eventList);

    foreach ($eventList as $eventItem) : 

        echo '<li><a href="'. $eventItem['Link'] .'">'. $eventItem['Title'] .' - '. $eventItem['Date'] .'</a></li>';

    endforeach;     

    ?>
</ul>

Edit - Oct 15

I recently had to try and use this integration method in a multi store that was using the same country code subdirectories as in this question by Matthias Zeis;

Different storeviews or websites in subfolders

I did consider trying the Fishpig multistore extension for this but in the end I asked a question on SO -> https://stackoverflow.com/questions/32613815/htaccess-wordpress-under-magento-site-with-multi-language-sub-directories

I've put the answer up there, it uses server environment variables and some Wordpress filters. I've added the .htaccess and Nginx server blocks too to help.

Also, for anyone who deploys their Magento site using Capistrano and shivers at the prospect of having the constantly updated Wordpress core and plugins polluting their repo I wrote a blog post showing how you can just move the whole lot into the shared directory in Capistrano 3 and only have your Wordpress theme in the repo;

http://www.mcnab.co/blog/wordpress-git-and-capistrano-v3/

  • Which of the WordPress plugins that you are proposing are you using the most? Also my Magento is in multiple languages. – jnbdz Oct 23 '13 at 18:17
  • 1
    this is a great answer as you get across the relative pros and cons of using Fishpig vs the Kemp plugin and so on. I have used the latter a few times and it works really well. Fishpig is good though for its power if you have the budget to buy the extra features. – Luke Barker May 14 '14 at 13:54
  • 1
    @McNab best advice I ever received on stackexchange.. thanks – s_h Feb 16 '15 at 4:05
  • 1
    @s_h - best comment I've ever received on stackexchange! Cheers :) – McNab Feb 16 '15 at 7:53
  • 1
    @JamesKemp - thanks for the plugin! Made my life a lot easier when it came to integrating the two systems. Cheers. – McNab Jul 2 '15 at 9:20
5

Fishpig's WordPress integration extension. It's free, works well, integrates the theme. Doesn't integrate the search. But it's the best integration method we're aware of.

5

Also you can use wordgento:
http://wordpress.org/plugins/tristar-wordgento/

I have used this for my blog and worked very well.

2

There is a free Magento plugin that allows you to use the content created with wordpress inside your Magento design. This allows you to use the power of the Wordpress blog and content inside your store. I dont know if the search is also in the wordpress content. See http://www.magentocommerce.com/magento-connect/wordpress-integration.html for more details.

protected by Community Nov 30 '16 at 21:16

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.