PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of amani  >  WordPress Term Post Count  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: class example
Class: WordPress Term Post Count
Get WordPress terms and posts using them
Author: By
Last change: I have mistake in sample code
Date: 6 years ago
Size: 949 bytes
 

Contents

Class file image Download
<?php

/**
 * <name>Wordpress Post and Term count</name>
 * <author>Akbar Amani </author>
 * <email> amania1364@gmail.com </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;

For more information send a message to info at phpclasses dot org.