سلام
من میخوام آمار هر پست توی نوشته هام برای کاربرا نشون داده بشه
و میخوام با کد نویسی و بدون افزونه این کارو بکنم
اومدم کدهایی که زیر رو در فایلها function و single قرار دادم
کدی که در فایل function قرار دادم: ( در قالب child قرار دادم )
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 =