How can i retrive the categories from a post_type that i select.
I have a Custom_field - categorie_serial
<?php
$values = get_field('categorie_serial');
if($values)
{
echo '<ul>';
foreach($values as $value)
{
echo '<li>' . $value . '</li>';
}
echo '</ul>';
}
// always good to see exactly what you are working with
var_dump($values);
?>
This code retrive me the categories but it retrive me an error The line 40 is "foreach($values as $value)"
Warning: Invalid argument supplied for foreach() in /home/****/public_html/****/wp-content/themes/movies/tabserial/detali-serial.php on line 40
string(334) "Gen SerialeActiuneAnimatieAventura"
How can i retrive the only the parent categories? I do not want to retrive Gen Seriale - categoriy , only Actiune..
RESOLVED:
<?php
$terms = get_terms('seriale','child_of=668');foreach ($terms as $term) {echo '<a href="'.get_term_link($term).'">'.$term->name.'</a>';}
?>