Odpowiedź forum utworzona

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cracker89

    (@cracker89)

    A jak to sprawdzić?

    Thread Starter cracker89

    (@cracker89)

    Sprawdziłem. W pliku functions znalazłem taki kod:

    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);
        }
    }

    Czy to oznacza, że nie muszę dodawać w/w kodu?

Viewing 2 replies - 1 through 2 (of 2 total)