Wednesday 25 April 2018

How to get Last Month's record data from MySQL Database?



SELECT * from product_order WHERE YEAR(order_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH) and MONTH(order_date) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)



Tuesday 24 April 2018

How to get This Month's record data from MySQL Database?


SELECT * from product_order WHERE MONTH(order_date) = MONTH(NOW()) and YEAR(order_date) = YEAR(NOW())


Saturday 21 April 2018

Monday 16 April 2018

How To Create Shortcode In WordPress with parameters?



<?php
### the shortcode code add in theme’s functions.php file  ###
// "do_shortcode" but without the wrapping <p> of Shortcodes
function do_shortcode_boc($content) {
 $array = array (
        '<p>[' => '[',
        ']</p>' => ']',
        ']<br />' => ']'
    );
$content = strtr($content, $array);
$content = do_shortcode($content);
    return $content;
}

function shortcode_shortcodename($atts, $content = null) {   
$atts = shortcode_atts(
array(
'title' => '',
'image' => '',
        ), $atts);

$title = $atts['title'] ? $atts['title'] : '';
$image = $atts['image'] ? $atts['image'] : '';

$str = '<li>
<div class="icon_item">
<img src="'.$image.'">
<p>'.html_entity_decode($title).'</p>
<div class="icon_overlay">
<p>'.do_shortcode($content).'</p>
</div>
</div>
</li>';
return $str;
}
add_shortcode('shortcodename', 'shortcode_shortcodename');

?>

##### Using below code to display shortcode detail  #####

[shortcodename title="my title" image="example.jpg"]
<div>
<p> Shortcode content </p>
</div>
[/shortcodename]

##### OR #####

<?php
echo do_shortcode('[shortcodename]');
?>