Advertisement
niammuddin

AGC Bing Versi dulu :D Berputar2 juga

Jun 4th, 2014
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.54 KB | None | 0 0
  1. <table>
  2. <?php
  3. // Get RSS Feed(s)
  4. include_once(ABSPATH . WPINC . '/feed.php');
  5. $query = urlencode($s);
  6. $rss = fetch_feed('http://www.bing.com/search?q=' . str_replace(' ', '+', $query) . '&go=&form=QBLH&filt=all&format=rss');
  7. if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly
  8. // Figure out how many total items there are, but limit it to 10.
  9. $maxitems = $rss->get_item_quantity(10);
  10. // Build an array of all the items, starting with element 0 (first element).
  11. $rss_items = $rss->get_items(0, $maxitems);
  12. endif;
  13. ?>
  14. <?php if ($maxitems == 0)
  15. echo ' ';
  16. else
  17. // Loop through each feed item and display each item as a hyperlink.
  18. foreach ( $rss_items as $item ) :
  19.  
  20. ?>
  21. <?php
  22. $erase = array ('block keyword di sini',';' , '%' , '+' , '-' , '&', ':' , 'amp;' , ' ...' , ' ....' , ' .....' , '–' , '|' , '/' , '[' , ']' , '?' , '$' , ','  , '.' , '«' , '(' , ')', '::' , '~');
  23. $first = str_replace ($erase , '' , $item->get_title());
  24. $encode = urlencode(strtolower($first));
  25. $plus = str_replace ('+' , '-' , $encode);
  26. $minus = array ('--' , '---' , '----');
  27. $link = str_replace ($minus , '-' , $plus);
  28. ?>
  29. <tr><td>
  30. <div style="margin:10px">
  31. <h2 class="postTitle" style="font-size:18px; color:#555;margin:5px 0px;">
  32. <a href="<?php bloginfo('url'); ?>/article/<?php echo $link; ?>.html"><?php echo $item->get_title(); ?></a>
  33. </h2>
  34. <p><?php echo $item->get_description(); ?></p>
  35. <span style="font-size:11px; color:#555;">source: <?php echo $item->get_permalink(); ?></span>
  36. </div>
  37. </td></tr>
  38. <?php endforeach; ?>
  39. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement