When you do normal loop (without where), is it possible to get to this data in category.name or category.slug, can you print them?
Is the category custom pods taxonomy?
I’ve tried. For me it works perfect, even if one book is novel and also comics(at least with pods 2.5)
I haven’t used ‘category’ because WP doesn’t let me to name pods taxonomy like this, nor ‘type’ (it printed pods name) so I named custom pods taxonomy ‘kind’:
<h1>NOVEL</h1>
<?php
//------------------------ NOVEL
$params = array('limit' => -1,
'where' => 'kind.name LIKE "%Novel%"');
$pods = pods('book', $params);
if ( $pods->total() > 0 ) {
while ( $pods->fetch() ) {
//Put field values into variables
$name = $pods->display('name');
$type = $pods->display('kind');
?>
<h2><?php echo $name; ?></h2>
<p><?php echo $type ?></p>
<?php
}//while ( $pods->fetch() )
}
else
echo 'Error';//( $pods->total() > 0 )
?>
<h2>COMICS</h2>
<?php
$params = array('limit' => -1,
'where' => 'kind.name LIKE "%Comics%"');
$pods = pods('book', $params);
if ( $pods->total() > 0 ) {
while ( $pods->fetch() ) {
//Put field values into variables
$name = $pods->display('name');
$type = $pods->display('kind');
?>
<h2><?php echo $name; ?></h2>
<p><?php echo $type ?></p>
<?php
}//while ( $pods->fetch() )
}
else
echo 'Error';//( $pods->total() > 0 )
?>
I got output like this:
NOVEL
aaa
novel
ccc
novel
ddd
comics and novel
COMICS
bbb
comics
ddd
comics and novel