Display amount of favorites for individual custom post types
-
Hello all, I’m currently trying to alter chacha2000 code here for use on custom post types and I can’t quite seem to figure it out. Any WP experts here care to help? Would be greatly appreciated!
This is the existing code from this above thread
function wpfp_get_current_count() { global $wpdb; $current_post = get_the_ID(); $query = "SELECT post_id, meta_value, post_status FROM $wpdb->postmeta"; $query .= " LEFT JOIN $wpdb->posts ON post_id=$wpdb->posts.ID"; $query .= " WHERE post_status='publish' AND meta_key='wpfp_favorites' AND post_id = '".$current_post."'"; $results = $wpdb->get_results($query); if ($results) { foreach ($results as $o): echo $o->meta_value; endforeach; }else {echo( '0' );} }
then place this
<?php wpfp_get_current_count(); ?>
Thanks for any help
https://www.ads-software.com/extend/plugins/wp-favorite-posts/
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Display amount of favorites for individual custom post types’ is closed to new replies.