بابهت: کۆدیی زۆرترین بینراو کێشەیی هەیە :(
ئەم کۆدە بەکا دەبەم بۆ ئەوەیی زۆرترین بینراو دابنێم بە بێپلەگین بۆیە هەموویی دەنوسرێ ٠ بینراو
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0 خوێنراوە";
}
return $count.' خوێنراوە';
}
function setPostViews($postID) {
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}وە بۆ بانگکردنیی ئەمە بەکاردێنم
<?php
echo getPostViews(get_the_ID());
?>