Wordpress에서 핑 (번호) 만 표시하는 방법이 있습니까?Wordpress에서 Ping (Pingbacks + Trackbacks) 번호 만 표시
실제로는 comments_number
기능이 있지만 주석, pingback 및 트랙백의 총 개수를 보여줍니다.
Wordpress에서 핑 (번호) 만 표시하는 방법이 있습니까?Wordpress에서 Ping (Pingbacks + Trackbacks) 번호 만 표시
실제로는 comments_number
기능이 있지만 주석, pingback 및 트랙백의 총 개수를 보여줍니다.
원하는 것을 정확히 모르시겠습니까? pingbacks 만 표시 하시겠습니까? 그렇다면 나는 시도하지 않았지만 Template Tags/wp list comments « WordPress Codex은 목록 핑백과 옵션을 보여줍니다.
다음 코드는 WordPress 2.9.1에서 작동합니다. 다른 버전에서도 작동하지만 2.9.1에 대해서만 테스트했습니다.
<?php
global $wpdb;
$post_id = get_the_ID();
$total_ping_count = $wpdb->get_var("SELECT count(comment_id) FROM $wpdb->comments WHERE comment_type = 'pingback'");
$total_approved_pings = $wpdb->get_var("SELECT count(comment_id) FROM $wpdb->comments WHERE comment_type = 'pingback' and comment_approved = 1");
$post_ping_count = $wpdb->get_var("SELECT count(comment_id) FROM $wpdb->comments WHERE comment_type = 'pingback' and comment_approved = 1 and comment_post_id = $post_id");
echo "The total number of pings on this site is $total_ping_count.\n";
echo "The total number of approved pings on this site is $total_approved_pings.\n";
echo "The total number of approved pings on this post is $post_ping_count.\n";
?>
위의 코드는 pingback에 대한 계산을 제공합니다. 핑백 대신 트랙백을 원할 경우 comment_type = 'pingback'
을 comment_type = 'trackback'
으로 변경하거나 조합 된 횟수를 변경하려면 comment_type IN ('pingback', 'trackback')
으로 변경하십시오.
고마워. 나는 그것을 시도 할 것이다. – fatihturan
핑 (ping)이 아닌 핑 (ping) 카운트를 보여주고 싶습니다. – fatihturan