Don't like ads? PRO users don't see any ads ;-)
Guest

functions.php - wooden fence

By: a guest on Aug 3rd, 2010  |  syntax: PHP  |  size: 1.75 KB  |  hits: 524  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. if(function_exists('register_sidebar')){
  3.         register_sidebar(array(
  4.                 'name' =>'Sidebar 1',
  5.                 'before_widget' => '<li><div id="%1$s" class="widget %2$s">',
  6.                 'after_widget' => '</div></li>',
  7.                 'before_title' => '<h4>',
  8.                 'after_title' => '</h4>')
  9.         );
  10.         register_sidebar(array(
  11.                 'name' =>'Sidebar 2',
  12.                 'before_widget' => '<li><div id="%1$s" class="widget %2$s">',
  13.                 'after_widget' => '</div></li>',
  14.                 'before_title' => '<h4>',
  15.                 'after_title' => '</h4>')
  16.         );
  17.         function unregister_problem_widgets() {
  18.                 unregister_sidebar_widget('search');
  19.         }
  20.         add_action('widgets_init','unregister_problem_widgets');
  21. }
  22.  
  23. // recent comments
  24. function get_recent_comments($args) {
  25.         global $wpdb, $comments, $comment;
  26.         extract($args, EXTR_SKIP);
  27.  
  28.         $themePath = get_bloginfo('template_url');
  29.        
  30.         $options = get_option('widget_recent_comments');
  31.        
  32.         if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
  33.                 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
  34.                 wp_cache_add( 'recent_comments', $comments, 'widget' );
  35.         }
  36.  
  37.                  echo $before_widget;
  38.                         echo $before_title . $title . $after_title;
  39.                         echo '<ul id="recentcomments">';
  40.                         if ( $comments ) : foreach ( (array) $comments as $comment) :
  41.                         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>';
  42.                         endforeach; endif;
  43.                 echo '</ul>';
  44.                 echo $after_widget;
  45.  
  46. }
  47.  
  48. function style_tag_cloud($tags){
  49.         return '<div style="padding:5px;">'.$tags.'</div>';
  50. }
  51. add_action('wp_tag_cloud', 'style_tag_cloud');
  52. include(TEMPLATEPATH.'/template.php');
  53. ?>