| 1 |
<?php |
| 2 |
add_action('wp_dashboard_setup', 'wp_insert_add_dashboard_widgets' ); |
| 3 |
function wp_insert_dashboard_widget_function() { |
| 4 |
include_once(ABSPATH . WPINC . '/feed.php'); |
| 5 |
$rss = fetch_feed('http://www.wp-insert.smartlogix.co.in/feed/'); |
| 6 |
if (!is_wp_error( $rss ) ) : |
| 7 |
$maxitems = $rss->get_item_quantity(10); |
| 8 |
$rss_items = $rss->get_items(0, $maxitems); |
| 9 |
endif; |
| 10 |
?> |
| 11 |
<ul> |
| 12 |
<?php if ($maxitems == 0) echo '<li>No items.</li>'; |
| 13 |
else |
| 14 |
foreach ($rss_items as $item) : ?> |
| 15 |
<li><a href='<?php echo $item->get_permalink(); ?>'><?php echo $item->get_title(); ?></a></li> |
| 16 |
<?php endforeach; ?> |
| 17 |
</ul> |
| 18 |
<?php |
| 19 |
} |
| 20 |
|
| 21 |
function wp_insert_add_dashboard_widgets() { |
| 22 |
wp_add_dashboard_widget('wp_insert_dashboard_widget', 'Wp-Insert News', 'wp_insert_dashboard_widget_function'); |
| 23 |
} |
| 24 |
?> |