Skip to content

Instantly share code, notes, and snippets.

View rajucs's full-sized avatar
🎯
Focusing

Arman Hossain rajucs

🎯
Focusing
View GitHub Profile
$difference = strtotime($list_vids['ExpirationDate']) - strtotime($now);
$hours = $difference / 3600; // 3600 seconds in an hour
$minutes = ($hours - floor($hours)) * 60;
$final_hours = round($hours,0);
$final_minutes = round($minutes);
1. https://www.regextester.com/96826
2. https://regexr.com/
@rajucs
rajucs / To check Bangladeshi Mobile number validation with 11 to 13 digit number with preg_match
Created September 28, 2019 05:51
To check Bangladeshi Mobile number validation with 11 to 13 digit number with preg_match
/^(?:\+88|01)?(01){1}[3456789]{1}(?:\d{13}|\d{11})$/
/**
* Sorting out of stock WooCommerce products - Order product collections by stock status, in-stock products first.
*/
class iWC_Orderby_Stock_Status
{
public function __construct()
{
// Check if WooCommerce is active
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
add_filter('posts_clauses', array($this, 'order_by_stock_status'), 2000);
.home .header-categories-nav .categories-menu-dropdown
{
visibility: visible;
opacity: 1;
transform: none;
pointer-events: visible;
}
<div class="entry-meta">
<div class="share-icon">
<h3>Share this page</h3>
<ul>
<li><a class="facebook" target="_blank" href="#"><i class="fa fa-facebook"></i></a></li>
<li><a class="twitter" target="_blank" href="#"><i class="fa fa-twitter"></i></a></li>
<li><a class="pinterest" target="_blank" href="#"><i class="fa fa-pinterest"></i></a></li>
<li><a class="google-plus" target="_blank" href="#"><i class="fa fa-google-plus"></i></a></li>
<li><a class="linkedin" target="_blank" href="#"><i class="fa fa-linkedin"></i></a></li>
</ul>
<ul class="social-link">
<li>
<a href=""><i class="fa fa-facebook"></i></a>
</li>
<li>
<a href="#"><i class="fa fa-twitter"></i></a>
</li>
<li>
<a href="#"><i class="fa fa-pinterest"></i></a>
woocommerce trim countrycode before submission
add_action( 'woocommerce_checkout_create_order', 'additional_hidden_checkout_field_save', 20, 2 );
function additional_hidden_checkout_field_save( $order, $data ) {
if( ! isset($data['billing_phone']) ) return;
if( ! empty($data['billing_phone']) ){
$phone = str_replace([' ','-','_'],['','',''], $data['billing_phone']);
$phone = ltrim(ltrim($phone, '0'),'+88');
To display author name with user icon add the following code to your xml file.
<i class='fa fa-user'/>
<a class='g-profile' expr:href='data:post.authorProfileUrl' expr:title='data:post.author' rel='author'>
<span itemprop='name'><data:post.author/></span>
</a>
<?php
$catTerms = get_terms('product_cat', array(
'hide_empty' => 0,
'orderby' => 'ASC',
'child_of'=>'30' // air sampling applications
));
echo '<ul>';
foreach($catTerms as $catTerm) {
echo '<li>
<a href="'. get_term_link($catTerm) .'" >' . $catTerm->name.'</a>