Skip to content

Commit

Permalink
Remove news widget from dashboard
Browse files Browse the repository at this point in the history
Fix for: https://tboy.co/sportsnews/ 
Redirected to:
https://leaguetower.com/feed/	
404 Not Found
  • Loading branch information
savvasha authored Jul 7, 2024
1 parent f812608 commit e477522
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions includes/admin/class-sp-admin-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function __construct() {
* Init dashboard widgets
*/
public function init() {
wp_add_dashboard_widget( 'sportspress_dashboard_news', esc_attr__( 'Sports News', 'sportspress' ), array( $this, 'news_widget' ), null, null, 'side' );
wp_add_dashboard_widget( 'sportspress_dashboard_status', esc_attr__( 'SportsPress', 'sportspress' ), array( $this, 'status_widget' ) );
add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 );
}
Expand Down Expand Up @@ -100,30 +99,6 @@ public function status_widget() {
</ul>
<?php
}

/**
* Show news widget
*/
public function news_widget() {
$rss = fetch_feed( 'https://tboy.co/sportsnews/' );
if ( ! is_wp_error( $rss ) ) { // Checks that the object is created correctly
// Figure out how many total items there are, but limit it to 2.
$maxitems = $rss->get_item_quantity( 5 );
// Build an array of all the items, starting with element 0 (first element).
$rss_items = $rss->get_items( 0, $maxitems );
}
if ( ! empty( $maxitems ) ) {
?>
<div class="rss-widget">
<ul>
<?php foreach ( $rss_items as $item ) { ?>
<li><a class="rsswidget" href="<?php echo esc_url( $item->get_permalink() ); ?>" target="_blank"><?php echo esc_attr( $item->get_title() ); ?></a> <span class="rss-date"><?php echo esc_html( $item->get_date( 'j F Y' ) ); ?></span></li>
<?php } ?>
</ul>
</div>
<?php
}
}
}

endif;
Expand Down

0 comments on commit e477522

Please sign in to comment.