Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table>
- <?php
- // Get RSS Feed(s)
- include_once(ABSPATH . WPINC . '/feed.php');
- $query = urlencode($s);
- $rss = fetch_feed('http://www.bing.com/search?q=' . str_replace(' ', '+', $query) . '&go=&form=QBLH&filt=all&format=rss');
- if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly
- // Figure out how many total items there are, but limit it to 10.
- $maxitems = $rss->get_item_quantity(10);
- // Build an array of all the items, starting with element 0 (first element).
- $rss_items = $rss->get_items(0, $maxitems);
- endif;
- ?>
- <?php if ($maxitems == 0)
- echo ' ';
- else
- // Loop through each feed item and display each item as a hyperlink.
- foreach ( $rss_items as $item ) :
- ?>
- <?php
- $erase = array ('block keyword di sini',';' , '%' , '+' , '-' , '&', ':' , 'amp;' , ' ...' , ' ....' , ' .....' , '–' , '|' , '/' , '[' , ']' , '?' , '$' , ',' , '.' , '«' , '(' , ')', '::' , '~');
- $first = str_replace ($erase , '' , $item->get_title());
- $encode = urlencode(strtolower($first));
- $plus = str_replace ('+' , '-' , $encode);
- $minus = array ('--' , '---' , '----');
- $link = str_replace ($minus , '-' , $plus);
- ?>
- <tr><td>
- <div style="margin:10px">
- <h2 class="postTitle" style="font-size:18px; color:#555;margin:5px 0px;">
- <a href="<?php bloginfo('url'); ?>/article/<?php echo $link; ?>.html"><?php echo $item->get_title(); ?></a>
- </h2>
- <p><?php echo $item->get_description(); ?></p>
- <span style="font-size:11px; color:#555;">source: <?php echo $item->get_permalink(); ?></span>
- </div>
- </td></tr>
- <?php endforeach; ?>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement