Support » Fixing WordPress » wp_widget_recent_entries deprecated in widgets.php?

  • Resolved jzahlaway


    In 2.7, in the file includes/widgets.php, one could modify the wp_widget_recent_entries function such that the Recent Posts widget would exclude certain categories.

    In 2.8, wp_widget_recent_entries is now deprecated. How, then, do I exclude certain categories from the Recent Posts widget?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi jzahlaway,
    I have the same problem. I copyed the functions (wp_widget_recent_entries and wp_widget_recent_comments) from the 2.7 in widgets.php from 2.8.1 and is works.

    Better solution are wellcome 🙂

    All the widgets moved to default_widgets.php. WP_Widget_Recent_Posts is a new class that takes the place of that old function.

    Hm, thanks Otto42, i have in the footer.php

    $recentParamEntry = array('number'=>'5', 'before_title'=>'<h3>', 'after_title'=>'</h3>', 'before_widget'=>'<div>', 'after_widget'=>'</div>');

    change to

    $recentParamEntry = array('number'=>'5', 'before_title'=>'<h3>', 'after_title'=>'</h3>', 'before_widget'=>'<div>', 'after_widget'=>'</div>');

    give me:

    Fatal error: Call to undefined function WP_Widget_Recent_Posts() in ……./wp-content/themes/home/footer.php on line 38

    It’s a class, not a function. You can’t call it like that.

    Try something more like this:

    $instance = array("title" => "My Widget", "number" => 5);
    $args = array("title" => "My Widget", 'before_title'=>'<h3>', 'after_title'=>'</h3>', 'before_widget'=>'<div>', 'after_widget'=>'</div>');
    $sb = new WP_Widget_Recent_Posts();
    $sb->number = $instance['number'];

    Ah fein, 1000x thank you. All problems solved, great!!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘wp_widget_recent_entries deprecated in widgets.php?’ is closed to new replies.