root/afridex/theme/feeds.php @ 18

Revision 5, 1.7 kB (checked in by admin, 18 years ago)
Line 
1<h2 class="stringent">
2<?php echo get_post_meta($post->ID, "Company", true) ?> Persistant Search</h2>
3<?php // Get RSS Feed(s)
4$org = get_post_meta($post->ID, "Company", true);
5//print $org;
6if ($org) {
7include_once(ABSPATH . WPINC . '/rss.php');
8$url = 'http://api.search.yahoo.com/WebSearchService/rss/webSearch.xml?appid=yahoosearchwebrss&query='. urlencode($org) . '+africa&adult_ok=1';
9$rss = fetch_rss($url);
10$maxitems = 10;
11$items = array_slice($rss->items, 0, $maxitems);
12foreach ( $items as $item ) :
13$title = substr($item['title'],0,55)."... ";
14?>
15<ul>
16<li><a href='<?php echo $item['link']; ?>' title='<?php echo $item['description']; ?>'>
17<?php print $title; ?>
18</a></li>
19</ul>
20
21<?php endforeach; 
22
23}
24?>
25
26<br /><br />
27       
28<h2 class="stringent"><?php echo get_post_meta($post->ID, "Company", true); ?> Blogstream</h2>
29
30<?php // Get RSS Feed(s)
31
32$feed = get_post_meta($post->ID, "Feed1", true); 
33// print $feed;
34
35if ($feed) {
36
37include_once(ABSPATH . WPINC . '/rss.php');
38 $url = $feed;
39// print $url;
40        $rss = fetch_rss($feed);
41 if ($rss == false){ 
42    $string .= "[No Feed To Retrieve]"; 
43    return $string; 
44 }
45$maxitems = 10;
46$items = array_slice($rss->items, 0, $maxitems);
47foreach ( $items as $item ) :
48// define the string which is '$title'
49// define the action 'substr' means sub-string or 'part of a string'
50// define where the feed string starts - first letter is '0'
51// define the length of the feed string - 55 characters
52// define the trailing characters - "..."
53$title = substr($item['title'],0,55)." ... ";
54?>
55<ul>
56<li><a href='<?php echo $item['link']; ?>' title='<?php echo $item['description']; ?>'>
57<?php print $title; ?>
58</a></li>
59</ul>
60
61<?php endforeach; 
62
63}
64?>
65<br /><br />
Note: See TracBrowser for help on using the browser.