posts"; $bfa_pp_request .= " WHERE post_status = 'publish' AND comment_count >= $bfa_pp_min_amount_comments"; $bfa_pp_request .= " AND post_password =''"; if ($bfa_pp_duration !="") $bfa_pp_request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$bfa_pp_duration." DAY) < post_date "; $bfa_pp_request .= " ORDER BY comment_count DESC LIMIT $bfa_pp_no_posts"; $bfa_pp_posts = $wpdb->get_results($bfa_pp_request); if ($bfa_pp_posts) { foreach ($bfa_pp_posts as $bfa_pp_post) { $bfa_pp_post_title = stripslashes($bfa_pp_post->post_title); $bfa_pp_comment_count = $bfa_pp_post->comment_count; $bfa_pp_permalink = get_permalink($bfa_pp_post->ID); $widget_mdv_most_commented .= '
  • ' . $bfa_pp_post_title . ' (' . $bfa_pp_comment_count . ')
  • '; } } else { $widget_mdv_most_commented = "None found"; } if ($widget_mdv_most_commented != "None found") { echo $before_widget . $before_title . $bfa_pp_title . $after_title; echo ""; echo $after_widget; } else { return $widget_mdv_most_commented; } } // This is the function that outputs the form to let the users edit // the widget's parameters. function widget_mdv_most_commented_control() { // Fetch the options, check them and if need be, update the options array $bfa_pp_options = $bfa_pp_newoptions = get_option('widget_mdv_most_commented'); if ( $_POST["bfa_pp_src-submit"] ) { $bfa_pp_newoptions['bfa_pp_title'] = strip_tags(stripslashes($_POST["bfa_pp_src-title"])); $bfa_pp_newoptions['bfa_pp_no_posts'] = (int) $_POST["bfa_pp_no_posts"]; $bfa_pp_newoptions['bfa_pp_duration'] = (int) $_POST["bfa_pp_duration"]; $bfa_pp_newoptions['bfa_pp_min_amount_comments'] = (int) $_POST["bfa_pp_min_amount_comments"]; $bfa_pp_newoptions['bfa_pp_display_homepage'] = !isset($_POST["bfa_pp_display_homepage"]) ? NULL : $_POST["bfa_pp_display_homepage"]; $bfa_pp_newoptions['bfa_pp_display_category'] = !isset($_POST["bfa_pp_display_category"]) ? NULL : $_POST["bfa_pp_display_category"]; $bfa_pp_newoptions['bfa_pp_display_post'] = !isset($_POST["bfa_pp_display_post"]) ? NULL : $_POST["bfa_pp_display_post"]; $bfa_pp_newoptions['bfa_pp_display_page'] = !isset($_POST["bfa_pp_display_page"]) ? NULL : $_POST["bfa_pp_display_page"]; $bfa_pp_newoptions['bfa_pp_display_archive'] = !isset($_POST["bfa_pp_display_archive"]) ? NULL : $_POST["bfa_pp_display_archive"]; $bfa_pp_newoptions['bfa_pp_display_tag'] = !isset($_POST["bfa_pp_display_tag"]) ? NULL : $_POST["bfa_pp_display_tag"]; $bfa_pp_newoptions['bfa_pp_display_search'] = !isset($_POST["bfa_pp_display_search"]) ? NULL : $_POST["bfa_pp_display_search"]; $bfa_pp_newoptions['bfa_pp_display_author'] = !isset($_POST["bfa_pp_display_author"]) ? NULL : $_POST["bfa_pp_display_author"]; $bfa_pp_newoptions['bfa_pp_display_404'] = !isset($_POST["bfa_pp_display_404"]) ? NULL : $_POST["bfa_pp_display_404"]; } if ( $bfa_pp_options != $bfa_pp_newoptions ) { $bfa_pp_options = $bfa_pp_newoptions; update_option('widget_mdv_most_commented', $bfa_pp_options); } // Default options to the parameters if ( !$bfa_pp_options['bfa_pp_no_posts'] ) $options['bfa_pp_no_posts'] = 10; if ( !$bfa_pp_options['bfa_pp_min_amount_comments'] OR $bfa_pp_options['bfa_pp_min_amount_comments'] == 0) $bfa_pp_options['bfa_pp_min_amount_comments'] = 1; $bfa_pp_no_posts = $bfa_pp_options['bfa_pp_no_posts']; $bfa_pp_duration = $bfa_pp_options['bfa_pp_duration']; $bfa_pp_min_amount_comments = $bfa_pp_options['bfa_pp_min_amount_comments']; $bfa_pp_display_homepage = $bfa_pp_options['bfa_pp_display_homepage']; $bfa_pp_display_category = $bfa_pp_options['bfa_pp_display_category']; $bfa_pp_display_post = $bfa_pp_options['bfa_pp_display_post']; $bfa_pp_display_page = $bfa_pp_options['bfa_pp_display_page']; $bfa_pp_display_archive = $bfa_pp_options['bfa_pp_display_archive']; $bfa_pp_display_tag = $bfa_pp_options['bfa_pp_display_tag']; $bfa_pp_display_search = $bfa_pp_options['bfa_pp_display_search']; $bfa_pp_display_author = $bfa_pp_options['bfa_pp_display_author']; $bfa_pp_display_404 = $bfa_pp_options['bfa_pp_display_404']; // Deal with HTML in the parameters $bfa_pp_title = htmlspecialchars($bfa_pp_options['bfa_pp_title'], ENT_QUOTES); ?> Title:

    Show posts not older than days and with at least  comment(s)


    And display the list on:

    /> Homepage

    /> Category Pages

    /> Single Post Pages

    /> "Page" Pages

    /> Archive Pages

    /> Tag Pages

    /> Search Result Pages

    /> Author Pages

    /> 404 Not Found Pages