Tagged: categories, fullwidth masonry, taxonomy
Hi,
I have searched through the forum and on the WordPress codex site but can’t seem to find an answer to this problem.
Using the Fullwidth Masonry to display the latest posts from the blog, is it possible to display the category that each post belongs to as well as the Title, Date and Author? I have tried several options and all return ‘Array’. The code I am using is pasted below.
Many thanks for any help.
Ben.
$this->loop[$key][‘taxonomies’] = get_object_taxonomies(get_post_type($the_id));
$cats = ”;
if(!empty($taxonomies))
{
foreach($taxonomies as $taxonomy)
{
if(!in_array($taxonomy))
{
$cats .= get_the_term_list($the_id, $taxonomy, ”, ‘, ‘,”).’ ‘;
}
}
}
if(!empty($cats))
{
echo ‘<span class=”blog-categories minor-meta”>’.__(”).” “;
echo $cats;
}
Hi!
Try putting print_r instead of echo:
print_r($cats);
This way you can inspect the returning Array.
Cheers!
Josue
Hi Josue,
Many thanks for your reply.
I’ve just tried replaying echo with print_r but it’s still returning ‘Array’. Any other ideas?
Thanks for your help.
Ben.
Hi Ben!
Well in that case, you’d need to refactor your code (the Array is returning empty), it would be better to contact a developer, please understand that this kind of customizations are out of our support scope.
Best regards,
Josue
Hi Josue,
No worries, many thanks for your help.
Best,
Ben.