Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<?php
/*
Plugin Name: ابزارک پیشخوان اخبار ورزشی
Plugin URI:
Description: این افزونه ابزارکی در اختیار شما قرار میدهد تا با آن آخرین اخبار ورزشی را در پیشخوان خود داشته باشید
Version: 0.1
Author: حامد مودی
Author URI: http://ircodex.ir/?author=1
License: GPL2
*/
defined('ABSPATH') || exit;
class Ircodex_Dashboard_Widgets_Sport_News {
function __construct() {
add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widgets' ) );
}
function add_dashboard_widgets() {
wp_add_dashboard_widget(
'Ircodex_Dashboard_Widgets_Sport_News',
'اخبار ورزشی',
array( $this, 'news_render'),
array( $this, 'news_control')
);
}
function news_render(){
$sportNewsRss = array(
'http://www.varzesh3.com/rss/all',
'http://www.varzesh3.com/rss/domesticFootball',
'http://www.varzesh3.com/rss/foreignFootball',
'http://www.varzesh3.com/rss/otherSports'
);
$randomIndex = rand(0, count($sportNewsRss) - 1 );
wp_widget_rss_output(array(
'url' => $sportNewsRss[$randomIndex],
'title' => 'اخیار ورزشی',
'items' => 10,
'show_summary' => true
));
}
}
$ircodex_news = new Ircodex_Dashboard_Widgets_Sport_News();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment