A validator for Iranian (Persian) national identifier or social number
c#
, java
, javascript
, php
parameter: string (It doesn't support arabic or persian numbers)
return: boolean
<?php | |
/** | |
* Extend WordPress search to include custom fields | |
* | |
* https://adambalee.com/search-wordpress-by-custom-fields-without-a-plugin/ | |
*/ | |
/** | |
* Join posts and postmeta tables | |
* |
<?php | |
/** | |
* first show in stack products in woocommerce loop | |
* last show out of stack products in woocommerce loop | |
*/ | |
add_filter( 'posts_clauses', 'wcss_manage_wp_posts_be_qe_posts_clauses', 1, 2 ); | |
function wcss_manage_wp_posts_be_qe_posts_clauses( $pieces, $query ) { | |
global $wpdb; | |
if ( ($query->is_main_query() && is_archive() && is_woocommerce()) |
<?php | |
/* | |
* Best way to remove out of stack products from related products | |
*/ | |
add_filter('woocommerce_product_related_posts_query','aah_product_related_posts_query', 10, 2); | |
function aah_product_related_posts_query( $query, $product_id ) { | |
global $wpdb; | |
$query['join'] .= " LEFT JOIN wp_postmeta ON ( p.ID = wp_postmeta.post_id )"; | |
$query['where'] .= " AND ( wp_postmeta.meta_key = '_stock_status' AND wp_postmeta.meta_value = 'instock' )"; |