Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #258269

    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;
    }

    #258425

    Hi!

    Try putting print_r instead of echo:

    print_r($cats);
    

    This way you can inspect the returning Array.

    Cheers!
    Josue

    #258529

    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.

    #258744

    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

    #258793

    Hi Josue,
    No worries, many thanks for your help.

    Best,
    Ben.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Display the category of each post in Fullwidth Masonry.’ is closed to new replies.