Bart Dabek
Post count: 24
|
ugh having a rough time with a simple if… need to check if the current post type has any category taxonomies assigned…
this isn’t working
if ($wf->the->has(‘category’)):
<h2>Categories:
foreach ($wf->the->categories() as $cat) echo $cat->link()
</h2>
endif
|
Bart Dabek
Post count: 24
|
also on the back of this… how would you insert a , after each printed result if there is more then one result? do you have to use a counter or is there a nifty way of inserting a separator?
|
Bart Dabek
Post count: 24
|
saw this for the 2nd question so I’m good
https://www.masterpressplugin.com/support/topic/separator-at-relatedterm
|
traversal
Post count: 207
|
Hey Bart,
The has method is not intended for taxonomy handling, that’s more for fields and field sets. Try:
if (count($wf->the->categories()))
or
if ($wf->the->categories->count)
|