Skip to content

Instantly share code, notes, and snippets.

View kashmiry's full-sized avatar
🌊
Flowing

Kash kashmiry

🌊
Flowing
View GitHub Profile
@kashmiry
kashmiry / orderby_coments_meta.php
Last active April 27, 2020 06:07
Wordpress: Order comments by custom_meta
<?php
#order comments by custom_meta
add_filter('comments_clauses','comments_order_by_meta');
function comments_order_by_meta($clauses){
global $wpdb;
#Join comments meta
$clauses['join'] = "
LEFT JOIN $wpdb->commentmeta
ON ( $wpdb->comments.comment_ID = $wpdb->commentmeta.comment_id ) AND ($wpdb->commentmeta.meta_key = 'kash_reviews_rating')
";
@kashmiry
kashmiry / dataTables.diacriticsArabic.js
Last active July 2, 2024 08:28
DataTables Arabic Search Normalization. this extends the diacritics function provided in DataTables >= 2.0
//ready
$(function() {
//extend diacritics to support arabic characters
if(typeof DataTable !== 'undefined') {
DataTable.util.diacritics(function(str, both) {
if(typeof str !== 'string') {
return str;
}
var normalized = str
.normalize("NFD")