'return', 'format' => '#c# #y# #sitename#. All Rights Reserved.' ); $option = wp_parse_args( $arg, $defaults ); global $post; $options = explode( "&",$options ); foreach ( $options as $option ) { $parts = explode( "=",$option ); $options[$parts[0]] = $parts[1]; } if ( $options['format'] ) $option['format'] = $options['format']; $format = str_replace( '#c#','©',$option['format'] ); $format = str_replace( '#y#',get_the_date( 'Y' ),$format ); $format = str_replace( '#sitename#',get_bloginfo( 'sitename' ),$format ); return $format; } function autocopyright( $format_result='format=Copyright ( #c# ) #from# - #to#' ) { /* legacy function for theme authors */ return thisismyurl_autocopyright( $format_result ); } function thisismyurl_autocopyright( $format_result='format=Copyright ( #c# ) #from# - #to#' ) { $all_posts = get_posts( 'post_status=publish&order=ASC&numberposts=1' ); $from = get_the_time( 'Y', $all_posts[0]->ID ); $all_posts = get_posts( 'post_status=publish&order=DESC&numberposts=1' ); $to = get_the_time( 'Y', $all_posts[0]->ID ); $format_result = str_replace( 'format=', '', $format_result ); $format_result = str_replace( '#from#',$from, $format_result ); $format_result = str_replace( '#to#',$to, $format_result ); $format_result = str_replace( '#c#',"©", $format_result ); return $format_result; } class thisismyurl_autocopyright_widget extends WP_Widget { function thisismyurl_autocopyright_widget(){ $widget_ops = array( 'classname' => 'widget_thisismyurl_autocopyright', 'description' => __("Auto Copyright by Christopher Ross" ) ); $this->WP_Widget( 'thisismyurl_autocopyright_widget', __( 'Auto Copyright' ), $widget_ops, $control_ops ); } function widget( $args, $instance ){ extract( $args ); echo $before_widget . thisismyurl_autocopyright() . $after_widget; } } function thisismyurl_autocopyright_widget_init() { register_widget( 'thisismyurl_autocopyright_widget' ); } add_action( 'widgets_init', 'thisismyurl_autocopyright_widget_init' );