网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > Blog(博客)/Wiki(维客)/RSS/Cms
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

Blog(博客)/Wiki(维客)/RSS/Cms Blog(博客)/、Wiki(维客)、RSS、Cms等WEB 2.0相关技术讨论专区。

Reply
 
Thread Tools Display Modes
  #1   IP: 117.95.50.177
Old 2010-06-18, 07:02 PM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default 外部网站如何调用WordPress文章?

利用第三方RSS and Atom Feed Framework调用WordPress
我使用的是这种方法,好处是调用代码是静态的,而非HTML代码。步骤如下,下载SimplePie Plugin for WordPress或者下载SimplePie最新版,将“simplepie.inc”上传到主机相应的目录,然后在需要调用的地方粘贴下面的代码即可(以万戈的Rss地址为例)。
<?php
require_once('simplepie.inc');
$feed = new SimplePie();
$feed->set_feed_url('http://www.glassesdaily.com/feed');
$feed->init();
echo '<ul>';
$i = 1;foreach($feed->get_items() as $item){
if($i<15){
echo '<li><a href="'.$item->get_permalink().'">'.$item->get_title().'</a><br />'. "\n";
echo substr($item->get_description(),0,180).'...</li>'."\n";
$i++; }}
echo '</ul>';
?>

当然,可以根据自己的需要修改这个代码的。
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 10:49 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.