bunu hara yazırıq bir az çox açıq yazsaz çox əla olardı kod çatdı ama necə yerləşdirim sayta qaranlıqdı təzə biri üçün
aha hamısı aydındı çox sağol,çox köməyin dəydi.
Bunun üçün single.php kodu əlavə edərəkdə görə bilərsiz ya da pluginlərdən istifadə edə bilərsiz. Nümunə üçün plugin
function.php-yə bu kodu əlavə edin
[code]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 “Bu yazı hələ oxunmayıb!”;
}
return $count.’ dəfə oxundu.’;
}
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);
}
}[/code]
daha sonra single.php-ni açıb ən son hissəsinə bunu əlavə edin
[code]<?php setPostViews(get_the_ID()); ?>[/code]
bu koddan sonra neçə dəfə oxunduğunu bilmək üçün harda istəyirsizsə bundan istifadə edin
[code]<?php
echo getPostViews(get_the_ID());
?>[/code]
WordPress Front Page Excluded Categories
Saytımdakı Yazını Googledə Axtaranda Archives Sözü Gəlir (WordPress)
wordpressle olan sayti tercume elemek