'sidebar-first', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', )); register_sidebar(array('name'=>'sidebar-second', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', )); } function mdv_recent_posts($no_posts = 5, $before = '
  • ', $after = '
  • ', $hide_pass_post = true, $skip_posts = 0, $show_excerpts = false, $include_pages = false) { global $wpdb; $time_difference = get_settings('gmt_offset'); $now = gmdate("Y-m-d H:i:s",time()); $request = "SELECT ID, post_title, post_excerpt FROM $wpdb->posts WHERE post_status = 'publish' "; if($hide_pass_post) $request .= "AND post_password ='' "; if($include_pages) $request .= "AND (post_type='post' OR post_type='page') "; else $request .= "AND post_type='post' "; $request .= "AND post_date_gmt < '$now' ORDER BY post_date DESC LIMIT $skip_posts, $no_posts"; $posts = $wpdb->get_results($request); $output = ''; if($posts) { foreach ($posts as $post) { $post_title = stripslashes($post->post_title); $permalink = get_permalink($post->ID); $output .= $before . '' . htmlspecialchars($post_title) . ''; if($show_excerpts) { $post_excerpt = stripslashes($post->post_excerpt); $output.= '
    ' . $post_excerpt; } $output .= $after; } } else { $output .= $before . "None found" . $after; } echo $output; } function mdv_recent_comments($no_comments = 5, $comment_lenth = 5, $before = '
  • ', $after = '
  • ', $show_pass_post = false, $comment_style = 0) { global $wpdb; $request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, post_title FROM $wpdb->comments LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->comments.comment_post_ID WHERE post_status IN ('publish','static') "; if(!$show_pass_post) $request .= "AND post_password ='' "; $request .= "AND comment_approved = '1' ORDER BY comment_ID DESC LIMIT $no_comments"; $comments = $wpdb->get_results($request); $output = ''; if ($comments) { foreach ($comments as $comment) { $comment_author = stripslashes($comment->comment_author); if ($comment_author == "") $comment_author = "anonymous"; $comment_content = strip_tags($comment->comment_content); $comment_content = stripslashes($comment_content); $words=split(" ",$comment_content); $comment_excerpt = join(" ",array_slice($words,0,$comment_lenth)); $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; if ($comment_style == 1) { $post_title = stripslashes($comment->post_title); $url = $comment->comment_author_url; if (empty($url)) $output .= $before . $comment_author . ' on ' . $post_title . '.' . $after; else $output .= $before . "$comment_author" . ' on ' . $post_title . '.' . $after; } else { $output .= $before . '' . $comment_author . ': ' . $comment_excerpt.'' . $after; } } $output = convert_smilies($output); } else { $output .= $before . "None found" . $after; } echo $output; } ?>