Posts

Showing posts from 2017

Add custom logo in wordpress login page

Put below code to your active themes functions.php

function wpAdminLoginLogo(){
    $custom_logo_id = get_theme_mod( 'custom_logo' );
    $logo_image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo $logo_image[0];?>);
padding-bottom: 30px;
height: auto !important;
background-size:210px;
width: 100%;
}
</style>
<?php
}
add_action( 'login_enqueue_scripts', 'wpAdminLoginLogo' );

Fatal error: Call to undefined function base_url() in CodeIgniter

You need to load the url helper within controller constructor or  function. $this->load->helper('url');OR
Add below code under application/config/autoload.php that looks like $autoload['helper']= array('url');

Update Custom Order Meta After a Successful Order in WooCommerce

Add this code at the bottom of your theme's functions.php

/* Add Shop Location Meta after order create*/ 
add_action( 'woocommerce_thankyou', 'rb_checkout_save_order_meta'); 
function rb_checkout_save_order_meta( $order_id ) { 
   update_post_meta( $order_id, 'shop_location', 'WW'); 
}

Add or edit orders item in WooCommerce Admin

Add below code to your active themes functions.php
/* Order Editable when in process*/
add_filter( 'wc_order_is_editable', 'rb_processing_orders_editable', 10, 2 );
function rb_processing_orders_editable( $is_editable, $order ) {
    if ( $order->get_status() == 'processing' ) {
        $is_editable = true;
    }
    return $is_editable;
}

Remove WordPress Redirecting to Nearest Matching URL

Add the below php code to your active theme’sfunctions.php:
remove_filter('template_redirect', 'redirect_canonical');

Remove Script and Stylesheet Version in Wordpress

Paste below code in the active themes function.php
functionremove_wp_version($src){ if( strpos( $src,'ver='. get_bloginfo('version')))
$src = remove_query_arg('ver', $src );return $src; }
add_filter( 'script_loader_src', 'remove_wp_version', 9999 );
add_filter( 'style_loader_src', 'remove_wp_version', 9999 );

Remove paypal checkout on product page in Prestshop

You need to follow these steps to fix it:
1. Login into PrestaShop admin panel
2. Click to Position under Module and Services tab
3. Scroll to displayFooterProduct and unhook it.

That's it. Enjoy...

Get YouTube video information using api in php

Follow below steps to get YouTube video information
Step 1:
create API key to authenticate with YouTube Login to google developer account https://console.developers.google.comStep 2:
 Create / Select project Create new key or Get API keyStep 3: Create a php script to get video details using YouTube video id
        Example:
        https://www.youtube.com/watch?v=ZdP0KM49IVk
        in this url video id is showing in Red color

Step 4: Add below code to your php file
<?php
$vdata = file_get_contents("https://www.googleapis.com/youtube/v3/videos?id=VIDEO_ID&key=YOUR_APIKEY&part=snippet,contentDetails,statistics,status");
$result_data = json_decode($vdata, true);
echo "<pre>";
print_r($result_data);
?>

Select every other row as male/female from mysql table

To Get the result from 'users' table as below +-----+--------+-------+ | row | gender | name | +-----+--------+-------+ | 1 | female | Lisa | | 2 | male | Greg | | 3 | female | Mary | | 4 | male | John | | 5 | female | Jenny | +-----+--------+-------+Follow the below querySELECT*FROM(SELECTusers.*,IF(gender=0,@mr:=@mr+1,@fr:=@fr+1)AS rank FROMusers,(SELECT@mr:=0,@fr:=0) initvars ) tmp ORDERBY rank ASC, gender ASC;