Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Counting CPT's of child and total images

$
0
0

I am trying to count the Total Number of CPT's of a child custom post type. The code I am using is as follows:

//Add shortcode for Tips Reviews Count

add_shortcode('reviews_tip_total', 'reviews_tip_total_func');
function reviews_tip_total_func()
{
$child_posts = types_child_posts('travel-tip-review');

return count($child_posts);
}

with the outputted shortcode being

[reviews_tip_total]

The problem is that it is showing 0 on the front end. What am I doing wrong?

I would also like to count all the images within the child CPT for CPT's which have images in Custom Field "tip-images"

Cheers


Viewing all articles
Browse latest Browse all 20145

Trending Articles