kieranbarnes do you know where your towel is?

CubeCart and Wordpress Integration

Posted on November 1, 2007

Following my 100% CubeCart orientated posts, here's another late night hack.

It integrates a Wordpress blog into your store's homepage.
You need a working Wordpress installation to start with, I installed mine in the standard /wordpress/ folder, none of your customers will see it anyway.

You will also need SimplePie which is a very fast and simple RSS Parser for PHP. Just download and place in any directory.

First off, edit includes/content/index.inc.php and put this about line 55

require('LOCATION TO SIMPLE PIE/simplepie.inc');$feed = new SimplePie('LOCATION TO WORDPRESS FEED');

$feed->handle_content_type();$i = 1;

$posts = Array();

foreach ($feed->get_items() as $item) {

$posts[$i]['LINK'] = $item->get_permalink();

$posts[$i]['TITLE'] = $item->get_title();

$posts[$i]['CONTENT'] = $item->get_content();

$posts[$i]['DATE'] = $item->get_date('j F Y | g:i a');

// assign array data

$index->assign('DATA', $posts[$i]);

$index->assign('ROW_NR', $i);

// parse a row

$index->parse('index.table.row');

$i++;

}

$index->parse('index.table');

Make sure you replace "LOCATION TO SIMPLE PIE" with the correct page.
Make sure you replace "LOCATION TO WORDPRESS FEED" with your wordpress feed. Don't know what this is? Goto your Wordpress blog and hit the RSS icon in the location bar to go to the feed location.

Next, edit yourskin/styleTemplates/content/index.tpl. I replaced the following


{HOME_TITLE}

{HOME_CONTENT}

with



{DATA.TITLE}

{DATA.CONTENT} {DATA.DATE}

This will replace the "Home Page" text with your blog entries.

Simple, huh?

If any one needs any help, customisation etc, contact me.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Related posts:

  1. WP-O-Matic Bug Fixes Round Up
    I've run into quite a few issues in the latest 1.0RC3-7 release of WP-O-Matic. Here's...
  2. Crawl Rate Tracker and Wordpress 2.5 Manual Fix
    A quick update on people that need the Crawl Rate Tracker to work with Wordpress...
  3. How to move Wordpress directory or server – properly
    I ran into an annoying, but easily avoided problem the other day. When moving a...
  4. Using Wordpress header and footers externally
    I needed to integrate a Wordpress header (header.php) and footer (footer.php) into an external application....
  5. Redirecting WordPress index.php to root
    If you check the Page Rank of http://bloke.org against http://bloke.org/index.php, which are both, to a...

What this article useful to you?



Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the CubeCart, Geeky, PHP category.

Comments (4) Trackbacks (1)
  1. i have been trying to your wordpress integration but i get this error:

    Parse error: syntax error, unexpected ‘&’ in /home/ourspot/public_html/includes/content/index.inc.php on line 60

    s

  2. ok so i sorted that bit out by replacing > with > but unfortunatley now i get this in the space where the blog should be

    [XTemplate]

    * parse: blockname [index.welcome_note] does not exist

    * parse: blockname [index.table] does not exist

    * parse: blockname [index] does not exist

  3. Hi

    I want to integrate wordprss blog with my wholesale store? Would you be able to help me on this matter? how much you will charge for this integration and customazation?

    Thank you
    abdu
    http://www.simsimgate.com

  4. i cant get this to link to my homepage please help!!!


Leave a comment