dyadica.net

Fun and Games in the Dyadic Sea

Posts Tagged ‘custom query’s’

permalink image comments image
Friday, 30 January '09: wordpress tag calls after a custom query

Having an issue with wordpress tag calls not working after a custom query, then try the following:

<?php
$tags = get_the_term_list( $post->ID, 'post_tag', '', ', ', '' ) ;
if($tags){ echo "Tags: " . $tags;
}else{ echo "Cats: "; the_category(','); }
?>

I have also included a category call: the_category(',') to cater for instances where no tags are available, due to no tags having been set or the call being made from a page.

The call breaks down as follows:

get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' )
Retrieve terms as a list with specified format.
param: int $id Term ID.
param: string $taxonomy Taxonomy name.
param: string $before Optional. Before list.
param: string $sep Optional. Separate items using this.
param: string $after Optional. After list.
return: string

I find this usefull as I have alot of unorthadox (grr the loop) query’s, hope it may help you. Please be aware unless you have a pugin to fix the issue, pages will always be appear as uncategorized.

Tags: , , ,

poll tags

css | xhtml | dyadica.net © admin 2010 | powered: wordpress | fuel: ps-wii-elite | top | sign-up