So, i needed to extract the term of a know taxonomy given to a page (like this:
function register_prod_categoria() {
register_taxonomy(
'prod-categoria',
array( 'produtos', 'page' ),
(produtos being a custom post type, just for info.)).
I tried various things, among them, this: get_terms('prod-categoria','')
This, works, but gives me everything about my taxonomy prod-categoria, which isn't what i needed.
Then as explained in the codex, two (interesting for me) parameters are available for get_terms()
: child_of and parent. This sounded perfect, so i went: get_terms('prod-categoria','child_of=marca');
and also get_terms('prod-categoria','parent=marca')
, marca being a term parent (from the custom taxonomy prod-categoria) from which i wanted to extract the child terms. Both gave me no results. I also tried with the name Marca and the slug marca, nothing.
The solution i ended up with is this: $tt = the_title('','',false);
. I'm getting the page title to use it as a parameter after: $posts = posts_search ('produtos',array('prod-categoria'=>$tt,'prod-cols'=>'5-C-P-F-NF-P')); if($posts) { echo "<table class=\"table-marca\">"; foreach($posts as $post) { ... }
Btw, the function posts_search() (found it on http://wordpress.stackexchange.com or http://stackoverflow.com if i'm right, don't remember for sure) allows to do queries on multiple taxonomies.
I agree very much that it's far away from being perfect, the title of the page having to be equal to the taxonomy name, but in my case it works. Thanks a lot to Rarst and Piet for trying to help.