Count children of a custom post

<?php
echo ezb_get_page_count();

function ezb_get_page_count(){
global $aquery,$wpdb;
$query = "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_parent = $aquery->ezb_id AND post_type = 'ezbook'";
$post_count = $wpdb->get_var($query);
return $post_count;
}
?>

0 Comments

You must be logged in to post a comment.