-1

I created a taxonmy vocabulary, added 3 terms in it Term1, Term2, Term3

Then I created a custom content type, and I associated it with that vocabulary term, so now everytime I create a page I check to which Term they belong to,

What I want to do is Loop the name of the Term + all the pages titles and body that belong to that term

For example:

<h1>Term1</h1>
<ul>
 <li>Page 1 title </li>
 <li>Page 2 title </li>
 </ul>
<h1>Term2</h1>

Thanks

0

This was the answer I was looking for

<?php
$nodes = node_load_multiple(array(), array('type' => 'analize'));
$listAnalize = [];
foreach ( $nodes as $kNod => $vNod ) {
  $term = taxonomy_term_load( $vNod->field_categoria_analizei['und'][0]['tid'] );

  $listAnalize[$vNod->field_categoria_analizei['und'][0]['tid']]['denumire'] = $term->name;
  $listAnalize[$vNod->field_categoria_analizei['und'][0]['tid']]['analize'][] = $vNod;
}
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.