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

February 12, 2011 


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