Ajit N

Check if array value isset and is null

Use array_key_exists() instead of isset(), because isset() will return false if the variable is null, whereas array_key_exists() just checks if the key exists in the array: [crayon-5a16fae39259a476652742/]  Read more …

To unserialize Data

$serialized_data = serialize(array(‘Math’, ‘Language’, ‘Science’)); echo¬† $serialized_data . ‘<br>’; echo ‘<br><br><br>’; $aa = unserialize($serialized_data); print_r($aa);Read more …

To Print Div

<script type=”text/javascript”> function PrintElem(elem) { Popup($(elem).html()); } function Popup(data) { var mywindow = window.open(”, ‘mydiv’, ‘height=400,width=600’); mywindow.document.write(‘<html><head><title>my div</title>’); /*optional stylesheet*/ //mywindow.document.write(‘<link rel=”stylesheet” href=”main.css” type=”text/css” />’); mywindow.document.write(‘</head><body >’); mywindow.document.write(data); mywindow.document.write(‘</body></html>’); mywindow.document.close(); // necessary for IE >= 10 mywindow.focus(); // necessary for IE >= 10 mywindow.print(); mywindow.close(); return true; } </script>Read more …

Date comparison code

echo $date1=strtotime(“31-12-2016”); echo “<br>”; echo $date2=strtotime(“03-01-2017”); echo “<br><br>”; if($date1<$date2) { echo “Second date is bigger”; } else { echo “First date is bigger”; }Read more …
keithg

Single page structure -Woocommerce

WooCommerce Visual Hook Guide: Single Product Page   // These are actions you can unhook/remove! add_action( 'woocommerce_before_single_product', 'wc_print_notices', 10 ); add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 ); add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); add_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );...Read more …