I need to integrate my Magento site with several Wordpress resources.
Since they are not just blog feed, I couldn't use a module or a rss block.
I found the best solution was including Wordpress header into Magento, and than call WP functions straight inside my blocks.
This is the magic line put on the top of Mage.php
require_once($_SERVER['DOCUMENT_ROOT'].'/wordpress/wp-blog-header.php');
Everything works fine, except that I have a lot of problems with AJAX now.
Some examples:
- modifying an attributes set rises a JSON decoding error;
- editing a Layout Update causes a validation error;
- connecting to Magento Connect, cause the site looks for wp-install.php.
All these errors disappear if i commented out the require_once line.
Did anyone face the same problem?
Any suggestion on how to include the line just for the homepage?
I've tried to move the line to another position, but it raise a conflict, so I have to leave it on the top of the file.
UPDATE:
I've tried to put the line in other places (index.php or template files), but I get two errors:
- Conflict with __() function (I had prevented it by hacking Magento's function, but moving the line, I need to modify wp-l10n.php too);
- Every time I try to visit a page, the site redirect me to wp-install.