
functions.php - wooden fence
By: a guest on
Aug 3rd, 2010 | syntax:
PHP | size: 1.75 KB | hits: 524 | expires: Never
<?php
if(function_exists('register_sidebar')){
register_sidebar(array(
'name' =>'Sidebar 1',
'before_widget' => '<li><div id="%1$s" class="widget %2$s">',
'after_widget' => '</div></li>',
'before_title' => '<h4>',
'after_title' => '</h4>')
);
register_sidebar(array(
'name' =>'Sidebar 2',
'before_widget' => '<li><div id="%1$s" class="widget %2$s">',
'after_widget' => '</div></li>',
'before_title' => '<h4>',
'after_title' => '</h4>')
);
function unregister_problem_widgets() {
unregister_sidebar_widget('search');
}
add_action('widgets_init','unregister_problem_widgets');
}
// recent comments
function get_recent_comments($args) {
global $wpdb, $comments, $comment;
extract($args, EXTR_SKIP);
$themePath = get_bloginfo('template_url');
$options = get_option('widget_recent_comments');
if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
wp_cache_add( 'recent_comments', $comments, 'widget' );
}
echo $before_widget;
echo $before_title . $title . $after_title;
echo '<ul id="recentcomments">';
if ( $comments ) : foreach ( (array) $comments as $comment) :
echo '<li class="recentcomments">' . sprintf(__('%1$s РЅР° %2$s'), get_comment_author_link(), '<a href="'. get_comment_link($comment->comment_ID) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
endforeach; endif;
echo '</ul>';
echo $after_widget;
}
function style_tag_cloud($tags){
return '<div style="padding:5px;">'.$tags.'</div>';
}
add_action('wp_tag_cloud', 'style_tag_cloud');
include(TEMPLATEPATH.'/template.php');
?>