Automatically Complete Orders

<pre>/**
* Auto Complete all WooCommerce orders.
* Add to theme functions.php file
*/

add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
    global $woocommerce;

    if ( !$order_id )
        return;
    $order = new WC_Order( $order_id );
    $order->update_status( 'completed' );
}

Simple WordPress Widget

[php]

<?php
/*
Plugin Name: Events Widget
Description:
*/

class events_widget extends WP_Widget {
function events_widget() {
parent::WP_Widget(false, $name = ‘Events Widget’);
}

function form($instance){
if ( isset( $instance[ ‘events_number’ ] ) ) {
$events_number = $instance[‘events_number’];
} else {
$events_number = 3;
}
?>
<p>
<label for="<?php echo $this->get_field_id( ‘events_number’ ); ?>"><?php _e( ‘Number of events:’ ); ?></label>
<input id="<?php echo $this->get_field_id( ‘events_number’ ); ?>" name="<?php echo $this->get_field_name( ‘events_number’ ); ?>" type="text" value="<?php echo esc_attr( $events_number ); ?>" />
</p>
<?php
}

public function update( $new_instance, $old_instance ) {
$instance = array();
$instance[‘events_number’] = ( ! empty( $new_instance[‘events_number’] ) ) ? strip_tags( $new_instance[‘events_number’] ) : ”;
return $instance;
}

function widget($args, $instance) {
echo $before_widget;?>

<?php echo $after_widget;
}
}

add_action(‘widgets_init’, create_function(”, ‘return register_widget("events_widget");’));

[/php]

WordPress Admin Whitescreen

There is a bug in WordPress 3.3.1 causing the issue. It may affect other versions as well.

To solve the issue you can update WordPress to the current stable release and do integration testing afterwards. Or you can do a quick bug fix.

To fix the bug:

  1. Open file blog/wp-admin/includes/screen.php in your favorite text editor.
  2. On line 706 find the following PHP statement: <?php echo self::$this->_help_sidebar; ?>
  3. Replace it with the statement: <?php echo $this->_help_sidebar; ?>
  4. Save your changes.

Hope it helps you.

 

http://wordpress.stackexchange.com/questions/127427/how-to-fix-empty-dashboard-issue-in-wordpress