Integrate WordPress functions on Magento

Per integrare tutte le funzioni di WordPress su Magento in modo da poter fare chiamate come wp_list_pages(), wp_list_categories() o la famosa WP_Query, basta far caricare WordPress da Magento prima che si carichi lui stesso (per evitare il sovrapporsi di header e funzioni varie).

Aprite il file index.php di Magento, all’inzio inserite le due righe:

define('WP_USE_THEMES', false);
require('/<you absolute path to wordpress root>/wp-load.php');
Ora rimane solo un piccolo problema, sia WordPress che Magento usano una funzione per fare la traduzione delle frasi, questa funzione purtroppo si chiama allo stesso moto “__” (2 underscore attaccati), per questo Magento andra’ in crisi (error redeclared function).
Per risolvere il problema basta andare ad aggiungere una condizione alla funzione di magento, nel file “app/code/core/Mage/Core/functions.php” fate diventare la funzione “__()” cosi’:
if (!function_exists('__')) {
function __() {
return Mage::app()->getTranslator()->translate(func_get_args();

Ora siete in grado di usare tutte le funzioni WordPress all’interno dei template Magento senza dover fare nulla di piu’.

Tags: , , , ,

Post simili:

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

26 Responses to “Integrate WordPress functions on Magento”
  1. Dellendoktor
    11:26 on December 12th, 2012

    A lot of interesting component here, very good direction, great thanks.

  2. Magento
    20:40 on July 3rd, 2012

    Thanks for this Magento update

  3. pvc
    14:07 on December 6th, 2011

    A lot of interesting component here, very good direction, great thanks.

  4. holiday shopping, christmas shopping, online shopping, internet marketing business, internet marketing advertising, money making business, money making opportunity, making jewelry online, home based jewelry business, jewelry business, resell jewelry, hand
    02:22 on October 2nd, 2011

    A person essentially assist to make severely posts I would state. This is the first time I frequented your website page and to this point? I surprised with the analysis you made to make this particular put up amazing. Magnificent task!

  5. Property Marbella
    15:46 on September 26th, 2011

    very nice! I’ll have to look it over some more. Might use it in my next WordPress Magento site.

  6. predictions 2012
    20:48 on September 25th, 2011

    Now that looks odd … but I have no idea why I happen to also find it very interesting! Merci!

  7. ProWebMarketing offer the best SEO Services in Montreal. Search engine optimization packages ready to get your websites ranked. See Here:
    11:46 on September 18th, 2011

    Thanks for any other excellent post. The place else may just anybody get that kind of info in such an ideal approach of writing? I have a presentation next week, and I’m on the look for such information.

  8. Free Followers
    20:39 on August 28th, 2011

    Hi there, I discovered your web site by the use of Google while looking for a related matter, your web site got here up, it seems great. I have bookmarked it in my google bookmarks.

  9. Buy Jewelry Online
    10:56 on July 1st, 2011

    Its not my field but I have little idea about all this,great job.I’ll share it with my friends who are in IT..

  10. Max Furniture
    19:24 on June 16th, 2011

    very nice! I’ll have to look it over some more. Might use it in my next WordPress Magento site.

  11. ugg boots
    08:52 on May 28th, 2011

    I believe that you will find your favourite ugg boots in the website-”
    I believe many people like snow boots, I am no exception. A variety of styles snow boots, colors are varied. We can see a lot of people in the street wear , especially some young people. Some girls wear it, we will find that they become more lovely friends. However, we have to choose your favorite, comfortable to wear. I am also a fan of snow boots, so the beauty of the sisters, in this cold winter to wear it now. In the cold winter will bring you warm.I believe that you will like the kind of ugg boots.

  12. business appraisals
    08:56 on May 24th, 2011

    This is actually a good example of why WordPress and Magento are not easily closely tied together.

  13. ugg boots
    07:48 on April 16th, 2011

    Ugg boots is a popular fashion element of this year, many people like to wear it, especially some young girls. Not only can warm to wear snow boots. And it make you different. We can see a lot of people in the street wear it, there are many colors, red, black, rice, etc., I also like the boots, so pretty girls, Why not act on, you also to join the ranks of snow boots, right.

  14. gina
    20:38 on April 8th, 2011
  15. webbaojia
    05:51 on February 18th, 2011

    Thank you very much.
    This was very useful for me.

  16. Yusuf
    11:44 on November 5th, 2010

    Michele first thank you in this post . your post is awesome .

    it’s also useful so keep it going and collect wonderful comment

  17. Sale on Ugg Boots
    15:01 on November 3rd, 2010

    Halo Michele,
    I have tried this solution, thank you very much for blogging about it. It sure works!
    However since I implemented it my admin login page makes funny characters and I cant log in?
    Have you seen this happen before? I am using 1.4.1

  18. Laura@buy electric guitar
    15:28 on October 11th, 2010

    Hi really enjoyed reading your post.
    Whats a good store front or ecommerce platform?

  19. KhmerHeartSandra
    18:36 on September 23rd, 2010

    this is good for future reference.

    I surf the net just to learn more about other cultures and search for the inspirations.
    site is one of the 1st tattoo sites that contain information that interest me.

    Thank you for sharing, Sandra

  20. Usi
    20:15 on September 5th, 2010

    @Diego I just installed this and work fine for me, it will be better if you upgrade to latest of wordpress.

Leave a comment