WP Security Audit Log

wp-security-audit-log

Its very important to ensure the security of your wordpress site, You have to take some basic security precautions for your site.WP Security Audit log will Identify WordPress security issues before they become a security problem. It Keeps  a security audit log of what is happening under the hood of your WordPress blog or website or your WordPress Multisite installation.

This plugin will work both on WordPress single site installations and WordPress Multisite.

 Audit Log plugin is developed by WordPress Security Consultants and Professionals WP White Security and is the only WordPress monitoring and auditing plugin that works on both WordPress single site installations and WordPress Multisite.

Download From: WordPress.org

Woocommerce – add products automatically to cart on visit

woothemes-ninja-logo-brand

Today i am going to share one of the feature which my client asked to me, and that is to add the product automatically once the visitor viewed that product. Hope this will help someone who is having requirement like this.

* To be added on theme's functions.php or a custom plugin
// add products automatically to cart on visit
add_action( 'init', 'add_product_to_cart' );
function add_product_to_cart() {
if ( ! is_admin() ) {
global $woocommerce;
$product_id = 64;
$found = false;
//check if product already in cart
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) {
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$_product = $values['data'];
if ( $_product->id == $product_id )
$found = true;
}
// if product not found, add it
if ( ! $found )
$woocommerce->cart->add_to_cart( $product_id );
} else {
// if no products in cart, add it
$woocommerce->cart->add_to_cart( $product_id );
}
}
}

Create Simple Shortcode In WordPress

We may come across some situations to use the shortcodes,even if you are a beginner, you can try to create your own shortcodes with below example.

The following short code will help you to embed from various video websites like vimeo, youtube etc.

/* Video Embed */
add_shortcode('video_embed', 'embed_video'); // This then accepts the function below embed_video and allows the user to enter the shortcode in there post.
function embed_video($atts){
    $atts = shortcode_atts(
        array(
            'src'       => ' ', // This is left blank but if you want to add a video as a default, that is up to you.
            'width' => '600', // Default Width
            'height'    => '338', // Default Height
            'title' => 'There is a video in this post.' // This a great default caption to have for your RSS Feeds. That way users will know that a video is available in the post to watch.
        ), $atts);
        return '
        <embed src="'.$atts['src'].'" type="application/x-shockwave-flash" width="'.$atts['width'].'" height="'.$atts['height'].'" allowscriptaccess="always" allowfullscreen="true"></embed>
        <h4>'.$atts['title'].'</h4>
        ';
}

The above functions can be copied to functions.php in your wordpress theme.

To display the video, the following shortcode can be used.

[video_embed src="http://www.youtube.com/watch?v=6WC5ufuc6m0" width="680" height="360" title="Sample Video"]