count - Show Only Pings (Pingbacks+Trackbacks) Number on Wordpress -


Is there a way to display the number of pings (numbers) on WordPress?

Actually there are functions but it shows total comments, pingbacks, and trackbacks.

The following code works on WordPress 2.9.1 It can work on other versions, but I Tested against only 2.9.1.

  & lt ;? Php Global $ wpdb; $ Post_id = get_the_ID (); $ Total_ping_count = $ wpdb-> Get_var ("wpdb-> Comments from" Select Count (comment_id) "where comment_type = 'pingback'"); $ Total_approved_pings = $ wpdb- & gt; Get_var ("wpdb-> where is comment_type = 'pingback' and comment_approved = 1" from select count (comment_id)); $ Post_ping_count = $ wpdb- & gt; Get_var ("Selection Number (comment_id) from $ wpdb-> in comments where comment_type = 'pingback' and comment_approved = 1 and comment_post_id = $ post_id"); Repeat "The total number of pings on this site is $ total_ping_count. \ N"; "The total number of pings allowed on this site is $ total_approved_pings. \ N"; Echo "The total number of pings accepted on this post is $ post_ping_count. \ N"; ? & Gt;  

The above code is only counted for pingback if you want trackback instead of pingback, then simply comment_type = 'pingback' to comment_type = 'trackback' Change or if you change it with a composite calculation, then it will be comment_type IN ('pingback', 'trackback') .


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -