| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Display latest Wordpress Posts | ||||
|
|
Thread Tools | Search this Thread |
#11
|
|||||||
|
|||||||
Re: Display latest Wordpress Posts
Here's my solution using RSS and a Smarty plugin to pull the latest posts from any wordpress blog.
Create this file include/templater/plugins/function.sr_wpfeed.php: PHP Code:
Then in whatever template you want to display the posts in you can display the posts something like this: Code:
This should work in any version of X-Cart as it doesn't use any X-Cart functions. Also there are no modifications to X-Cart php code so it doesn't get wiped out by upgrades.
__________________
Manuka Bay Company X-Cart Version 4.0.19 [Linux] UGG Boots and other fine sheepskin products http://www.snowriver.com |
|||||||
|
#12
|
|||||||||
|
|||||||||
Re: Display latest Wordpress Posts
This didn't work for me. My site is *.co.uk and my blog is *.co.uk/blog/.
I copied everything 100%, then just changed the URL to match my wordpress blog homepage. What did I do wrong? |
|||||||||
#13
|
|||||||||
|
|||||||||
Re: Display latest Wordpress Posts
p.s. I currently use simplepie to display RSS feed snippets. Could there be a conflict?
|
|||||||||
#14
|
|||||||
|
|||||||
Re: Display latest Wordpress Posts
Sorry, my example usage has a mistake. You need to use $somepost instead of $someposts inside the foreach loop like this:
Code:
__________________
Manuka Bay Company X-Cart Version 4.0.19 [Linux] UGG Boots and other fine sheepskin products http://www.snowriver.com |
|||||||
#15
|
|||||||||
|
|||||||||
Re: Display latest Wordpress Posts
Hi,
I added: Code:
but I got the following errors: Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.promartsupplements.co.uk/blog//feed:1: parser error : Document is empty in /home/promarts/public_html/include/templater/plugins/function.sr_wpfeed.php on line 91 Error: Smarty error: Error reading XML file in /home/promarts/public_html/Smarty-2.6.19/Smarty.class.php on line 1092 Warning: Invalid argument supplied for foreach() in /home/promarts/public_html/include/templater/plugins/function.sr_wpfeed.php on line 95 Any ideas what is causing the errors? Thanks, |
|||||||||
#16
|
|||||||
|
|||||||
Re: Display latest Wordpress Posts
That's puzzling as http://www.promartsupplements.co.uk/blog//feed properly returns the XML data so it shouldn't be empty. If you have ssh access on your server what does this do?:
wget http://www.promartsupplements.co.uk/blog//feed If that can't download the XML and you can in a browser check with your host to see why you can't load local URL's.
__________________
Manuka Bay Company X-Cart Version 4.0.19 [Linux] UGG Boots and other fine sheepskin products http://www.snowriver.com |
|||||||
#17
|
|||||||||
|
|||||||||
Re: Display latest Wordpress Posts
Just installed this for a client - works great. Thanks Ralph
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#18
|
|||||||||
|
|||||||||
Re: Display latest Wordpress Posts
Saw just one glitch - double and single quotes in description are converted to some other characters (I suspect some toher special characters are affected as well). I tried html_entity_decode and htmlspecialchars_decode but no luck. Do you have any idea Ralph?
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#19
|
|||||||
|
|||||||
Re: Display latest Wordpress Posts
That's Wordpress converting quotes to smart quotes. Here's a link on how you can turn them off in Wordpress:
http://www.lancebledsoe.com/how-to-turn-off-wordpress-smart-quotes/ If you want to leave them as smart quotes on your wordpress blog but convert them back for the RSS feed you'll need to add some code to convert them. Here's a discussion of how that can be done. http://shiflett.org/blog/2005/oct/convert-smart-quotes-with-php
__________________
Manuka Bay Company X-Cart Version 4.0.19 [Linux] UGG Boots and other fine sheepskin products http://www.snowriver.com |
|||||||
|
#20
|
|||||||||
|
|||||||||
Re: Display latest Wordpress Posts
Thanks Ralph
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
|||
X-Cart forums © 2001-2020
|