Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Display latest Wordpress Posts

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #21  
Old 02-25-2013, 03:16 AM
 
philrisk philrisk is offline
 

X-Adept
  
Join Date: Jul 2009
Location: Newcastle upon Tyne, UK
Posts: 412
 

Default Re: Display latest Wordpress Posts

Can you use this to call the image from the feed too?
__________________
Live with Gold 4.5.1
Dedicated Linux server
MaxCDN 4 pull zones
Dedicated SSL

Reply With Quote
  #22  
Old 04-02-2015, 04:49 PM
 
Eyeglasses Expert Eyeglasses Expert is online now
 

eXpert
  
Join Date: May 2010
Posts: 307
 

Default Re: Display latest Wordpress Posts

Quote:
Originally Posted by autobulbs
This mod assumes that you use the Wordpress blogging software and uses the same database as your xcart software.
If your wordpress and x-cart use separate database then use this code for blog_headlines.php

If you do not use the default Wordpress SQL table prefix than you will need to specify it in the select query.
For example, change wp_posts to yourprefix_posts

Create xcart-root/include/blog_headlines.php and paste this in it:
Code:
<?php $blog_headlines = func_query("SELECT post_title,guid,post_date as orderby, DATE_FORMAT(post_date,'%d/%m/%Y') as post_date FROM wp_posts WHERE post_status = 'publish' group by post_title order by orderby desc limit 3"); array("blog_headlines" => array()); $smarty->assign("blog_headlines", $blog_headlines); ?>

Create xcart-root/skin1/blog_headlines.tpl and paste this in it:
Code:
{* $Id: blog_headlines.tpl,v1 09/01/29 11:18:59 max Exp $ *} {capture name=menu} {foreach from=$blog_headlines item=bh}<a href="{$bh.guid}" class="blog_headlines">{$bh.post_title}</a><div class="blog_headlines">{$bh.post_date}</div><br class="blog_headlines"/><hr noshade="noshade" size="1" class="blog_headlines" />{/foreach} {/capture} {include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title="Blog Headlines" menu_content=$smarty.capture.menu}

Open xcart-root/init.php and add this at the end:
Code:
#Blog Headlines include($xcart_dir."/include/blog_headlines.php");

Open xcart-root/skin1/skin1.css and add this:
Code:
/*** Blog Headlines Styles Start ***/ a.blog_headlines { /* The link */ display:block; } a.blog_headlines:hover { /* The link when hovered over */ background:#d7d7d7; } hr.blog_headlines { /* The line */ color:#e1e1e1; } div.blog_headlines { /* The date */ float:right; } br.blog_headlines{ clear:left; } /*** Blog Headlines Styles End ***/

Open xcart-root/skin1/customer/home.tpl file and add this within VertMenuLeftColumn (or where ever appropriate):
Code:
{include file="blog_headlines.tpl"}

i have tried this method under x-cart v4.6.6 for www.glassespeople.com
i can get the wordpress posts, but i got another problem. my sites verifying code does not shows, all image under admin panel does not display
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:36 PM.

   

 
X-Cart forums © 2001-2020