Advertisements

tag_rows

Definition:
function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'post_tag' ) {}

Parameters

  • unknown_type $page
  • unknown_type $pagesize
  • unknown_type $searchterms
  • $taxonomy

Source code

function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'post_tag' ) {



	// Get a page worth of tags

	$start = ($page - 1) * $pagesize;



	$args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);



	if ( !empty( $searchterms ) )

		$args['search'] = $searchterms;



	// convert it to table rows

	$out = '';

	$count = 0;

	if ( is_taxonomy_hierarchical($taxonomy) ) {

		// We'll need the full set of terms then.

		$args['number'] = $args['offset'] = 0;



		$terms = get_terms( $taxonomy, $args );

		if ( !empty( $searchterms ) ) // Ignore children on searches.

			$children = array();

		else

			$children = _get_term_hierarchy($taxonomy);



		// Some funky recursion to get the job done(Paging & parents mainly) is contained within, Skip it for non-hierarchical taxonomies for performance sake

		$out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count);

	} else {

		$terms = get_terms( $taxonomy, $args );

		foreach( $terms as $term )

			$out .= _tag_row( $term, 0, $taxonomy );

		$count = $pagesize; // Only displaying a single page.

	}



	echo $out;

	return $count;

}

2935

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: