| 
<?php
 /**
 * <name>Wordpress Post and Term count</name>
 * <author>Akbar Amani </author>
 * <email> [email protected] </email>
 * <version>PostCount v1.0</version>
 * <url>webreference.ir</url>
 * <copyright> Copyright (C) 2014 GNU General Public License. All rights reserved.    GNU/GPL</copyright>
 */
 
 
 
 include_once("PostCount.php");
 
 // send wordpress databse class to use in query
 $terms = new PostCount($wpdb);
 
 //set an id to get posts and terms
 // 'publish'    for published posts;
 // ''             for all posts
 $status = '';
 $terms->SetTermID(162, $status);
 
 // get all post count (from all child terms)
 $post_count = $terms->post_count();
 
 // get all child term count
 $term_count = $terms->term_count();
 
 // get all posts id as array
 $post_id_array = $terms->post_id_array();
 
 // get all terms id as array
 $term_id_array = $terms->term_id_array();
 
 // get term child level
 $term_level = $terms->$term_level;
 |