Integrate WordPress feeds in Magento

This article assumes you have already integrated WordPress and Magento and are using v1.2.0 or higher.

 

feedly

On a CMS page or static block

If you want to integrate the feeds inline a cms page or on a static block, then you can use the following code:

{{block="wordpress/feed" feedUrl="http://example.com/blog/feed" template="wordpress/feed.phtml"}}

To set custom options, you can just add it into the command, Eg.

{{block="wordpress/feed" maxChar="150" dateFormat="d-m-Y" feedUrl="http://example.com/blog/feed" template="wordpress/feed.phtml"}}

Available custom options

pTitle="Latest news" â

  • Pingback: Simple and effective Wordpress and Magento integration | Manchester Magento web design, development, Magento hosting and aftercare :: sonassi

  • http://www.bizion.org Ricardo

    How can I include content or the sidebar inside the home block? I want to put a list of the latest articles just like the picture you have above, but in the home block.. please help me

  • http://www.sonassi.com ben@sonassi.com

    What do you mean by home block? The content block on the cms home page?

  • http://www.bizion.org Ricardo

    yes, i made it work with your explanations in this page, thanks.
    Something is weird, when i set the plimit to 4 it shows 5 posts, when i set it to 3 it shows 4 post, i think its counting from zero, so i think it should show what I set.
    I think you have to fix that to avoid confussing people.
    For the rest, THANKS, this is what i was looking for.
    You should create a method to insert the feeds modifying the .phtml template files.
    And a method to actually show the real wordpress widgets in magento.

  • http://www.bizion.org Ricardo

    I have succesfully created a nice looking News Ticker modifying your implementation a little bit. If you wanna check it you can visit http://www.naturesgarden.com.ec :) thanks a lot again.

  • Christopher

    I am using magento 1.4.0.1 and wordpress 2.9.2. I have got the blog working, but if I try to use your code for inserting the xml feed in the Magento sidebar, it just falls over. The feed itself works, and I’m using the correct url.

    Any idea why I am getting the following error?

    [code]Warning: Invalid argument supplied for foreach() in /var/www/magento_ayurved_dev/htdocs/app/code/local/Sonassi/Wordpress/Block/Feed.php on line 15[/code]

    I put the XML snippet into design/default/default/templates/local.xml like so:

    [code]
    http://my-website-url.no/blog/feed
    [/code]

  • http://www.bizion.org Ricardo

    Hello, how can i also show the post thumbnail?
    It only show title, date and excerpt, but i would like to include the post thumbnail please help me

    Thanks in advance

  • http://www.sonassi.com ben@sonassi.com

    Hi Christopher,

    Given you’ve not provided me with a URL for the site – I can’t really tell you why it isn’t working :(

  • http://www.bizion.org Ricardo

    Please help me to also show post thumbnail

  • http://www.magento3.com Pavel

    Hi Ben,

    I have same error Christopher has. If the wordpress category is empty and have no posts, the feed throws error in magento:
    Warning: Invalid argument supplied for foreach() in /home/np27405/domains/magento3.com/public_html/goa/app/code/local/Sonassi/Wordpress/Block/Feed.php on line 15″;i:1;s:3639:”#0 /home/np27405/domains/magento3.com/public_html/goa/app/code/local/Sonassi/Wordpress/Block/Feed.php(15): mageCoreErrorHandler(2, ‘Invalid argumen…’, ‘/home/np27405/d…’, 15, Array)

    How can i get over this problem? Is there any chance of just display message “No news at this moment” or just empty block?

    Thank You

  • Bill

    What about customers and wordpress users? Do the two use the same user table or sync in any way? This looks like an awesome modification. I’d like to give it a try but wondering how to maintain the differences in users roles between the two apps. Any hints would be great.

    Thanks for the awesome mod

  • Bill

    Also have you tried this with WP3 and latest magento 1.4.01?

  • http://www.sonassi.com ben@sonassi.com

    Yes, but it did require a couple of modifications, we will be releasing an update shortly.

  • http://www.sonassi.com ben@sonassi.com

    Hi Ricardo,

    I’m afraid we don’t have the time to write a guide on this. But if you would like us to develop the functionality, we can do – but it would be for a small fee.

  • http://www.sonassi.com ben@sonassi.com

    Hi Bill,

    They are totally separate, but in the deluxe edition – the customer profile is synced with their WordPress profile (which is dynamically created).

  • http://www.sonassi.com ben@sonassi.com

    Hi Pavel,

    It could probably be easily fixed by adding a simple is_array() to validate the contents of the variable.

  • Jonathan

    Hello, ty for sharing.

    I have a question, you have a demo, in that the integration of worpress are in the magento admin, this its a special realise ?

    Or i´m doing something wrong?

  • http://www.sonassi.com ben@sonassi.com

    Hi Jonathan,

    There is two demo’s “demo.sonassi.com” is the standard WordPress extension; where the theme and basic support for comments is integrated. Whereas the demo shown on http://www.sonassi.com/knowledge-base/magento-knowledge-base/like-our-standard-magento-wordpress-integration-try-the-deluxe-version/ is the deluxe version, which is completely integrated and not only combines the admin, but uses the power of Magento’s MVC framework to control the layout.

  • Jonathan

    Hi Ben,

    Thank you for reply, could you please tell me, how much cost the full integration or package.

    If it´s posible send me a email that info.

  • http://outsidelightsuk.co.uk/ Steve Evans

    It will be good to to integrate the feeds inline, on a cms page or on a static block from an SEO point of view as it will increase internal linking? Is that right?

  • http://www.sonassi.com Benjamin

    You can, with WordPress Deluxe :)