'; echo __('Thank you for using the Admin Rss Feed plugin! Go to Plugin ', 'admin-dashboard-rss-feed'); echo '' . __('Settings Page', 'admin-dashboard-rss-feed') . ''; echo '

'; ?>
' . __('Settings', 'admin-dashboard-rss-feed') . ''; return $wsx_rss_feed_link; } // Create custom plugin settings menu add_action('admin_menu', 'wsx_rss_feed_admin_page'); function wsx_rss_feed_admin_page() { // create new top-level menu add_options_page('Admin Dashboard RSS Feed Plugin Settings', 'Admin Dashboard RSS Feed', 'manage_options', __FILE__, 'wsx_rss_feed_admin_settings_page'); // call register settings function add_action('admin_init', 'wsx_rss_feed_admin_settings'); } function wsx_rss_feed_styles() { wp_register_style('wsx-rss-styles', plugin_dir_url(__FILE__) . 'admin/css/style.css'); wp_enqueue_style('wsx-rss-styles'); } add_action('admin_enqueue_scripts', 'wsx_rss_feed_styles'); function wsx_rss_feed_admin_settings() { // register our settings // Save attachment ID if (isset($_POST['image_attachment_id'])): update_option('wsx_rss_feed_image_attachment_id', absint($_POST['image_attachment_id'])); endif; if($_GET['page'] == "admin-dashboard-rss-feed/admin-rss-feed.php") { wp_enqueue_media(); } // Get the Company Logo Title register_setting('wsx-rss-feed-settings-group', 'wsx_logo_title'); // Get the Company Logo Target Link register_setting('wsx-rss-feed-settings-group', 'wsx_logo_target_link'); // Feed URL register_setting('wsx-rss-feed-settings-group', 'wsx_rss_feed_url'); // Feed Count register_setting('wsx-rss-feed-settings-group', 'wsx_rss_feed_count'); } function wsx_rss_feed_admin_settings_page() { ?>

Admin Dashboard RSS Feed Settings

Your Company Name:
Your Company Logo:
(We suggest 64 pixels wide x 64 pixels high) '>
Your Company Website:
Your Company RSS Feed URL:
Number of items to display:
"") { $rss_feed_url = esc_attr(get_option('wsx_rss_feed_url')); } else { echo "Enter the valid feed URL"; } $wsx_rss_feeds = array("$rss_feed_url"); // Loop through Feeds foreach($wsx_rss_feeds as $feed): // Get a SimplePie feed object from the specified feed source. $rss = fetch_feed($feed); if (!is_wp_error($rss)): // Checks that the object is created correctly // Figure out how many total items there are, and choose a limit $feed_count = esc_attr(get_option('wsx_rss_feed_count')); if ($feed_count <> "") { $feed_count = esc_attr(get_option('wsx_rss_feed_count')); } else { $feed_count = "5"; } // echo $feed_count; $maxitems = $rss->get_item_quantity($feed_count); // Build an array of all the items, starting with element 0 (first element). $rss_items = $rss->get_items(0, $maxitems); // Get RSS title $rss_title = '' . strtoupper($rss->get_title()) . ''; endif; // Display the container $wsx_logo_url = wp_get_attachment_url(get_option('wsx_rss_feed_image_attachment_id')); $wsx_logo_title = esc_attr(get_option('wsx_logo_title')); $wsx_logo_target_link = esc_attr(get_option('wsx_logo_target_link')); echo '
'; if ($wsx_logo_url <> "" && $wsx_logo_target_link <> "" && $wsx_logo_title <> "") { $title = 'title="' . $wsx_logo_title . '"'; $alt = 'alt="' . $wsx_logo_title . '"'; echo "
"; echo '
' . $wsx_logo_title . ''; echo '' . $wsx_logo_target_link . '
'; } else if ($wsx_logo_url <> "" && $wsx_logo_target_link <> "") { echo "
"; echo '' . $wsx_logo_target_link . '
'; } else if ($wsx_logo_url <> "" && $wsx_logo_title <> "") { $alt = 'alt="' . $wsx_logo_title . '"'; echo "
"; echo '
' . $wsx_logo_title . '
'; } else if ($wsx_logo_title <> "" && $wsx_logo_target_link <> "") { echo '
' . $wsx_logo_title . '

'; echo '' . $wsx_logo_target_link . '
'; } else { if ($wsx_logo_url <> "") { echo "
"; } if ($wsx_logo_title <> "") { echo '
' . $wsx_logo_title . '
'; } if ($wsx_logo_target_link <> "") { echo ""; } } echo '
'; endforeach; // End foreach feed } add_action('admin_footer', 'media_selector_print_script'); function media_selector_print_script() { if($_GET['page'] == "admin-dashboard-rss-feed/admin-rss-feed.php") { $wsx_rss_feed_image_attachment_post_id = get_option('wsx_rss_feed_image_attachment_id', 0); ?>