Support

Account

Home Forums General Issues Advance Custom Fields, Timber and retrieving user's name

Solving

Advance Custom Fields, Timber and retrieving user's name

  • I’m trying to find a way to display the name of each user below the post, they will be listed as the author and contributors, each name will be linked to their profile, and in their profile there are also fields (from ultimate member plugin) which are their crypto wallets public addresses, that’s a way they can use to receive cryptocurrency donations for their contributions to the blog. I summarized everything in the following sketch:
    Authors and Donation

    The problem is that I’m using Gantry5 framework and only recently I found out that Gantry uses a programming language of its own, called Timber (correct me if I’m wrong), this also brings back some memories about Final Fantasy XVIII, well, anyway, the problem I’m facing here is that I’m not being able to retrieve the user’s name.

    The file’s name is “content-single.html.twig”, located in the following structure “themes/g5_helium/views/partials/”. Using Gantry5 Helium Theme.
    But since I’ve created a custom override, it’s located at:
    “themes/g5_helium/custom/views/partials/”

    I’m editing the area after this part:

      {# Begin Page Content #}
                    {{ post.paged_content|raw }}
    
                    {{ function('wp_link_pages', {'before': '<div class="page-links" itemprop="pagination"><ul class="pagination-list">', 'after': '</ul></div>', 'link_before': '<span class="page-number page-numbers">', 'link_after': '</span>', 'echo': 0}) }}
                    {# End Page Content #}

    And this is what I’ve used after a person in Gantry community helped me:

    {% set post_id = function('get_the_ID') %}
    {% set post = wordpress.call('Timber::get_post', post_id) %}
    {{ post.meta('autor')|raw }}				
    {{ post.meta('narrador')|raw }}	

    The problem is that whether I set the data format for user array or user object, I’m getting “Array” as output. Only if I set User ID I get the ID number, but that’s not what I need, what I need is to display the name of the user, and display it linked to their profile, just like it’s shown in the sketch. When I check the timber docs, it doesn’t seem to have much info on ACF there. If it was php only, it would be easy for me to find a workaround, but I’m totally lost because it’s timber.

  • wow, that’s a really mean way to reply.

  • I was just linking to your other topic which is the same issue. Sorry, if you think his is mean, that was not my intent. Since they are both your topics I figured you see that. There are plenty of topics that I reply to with just a link to existing topics rather that rehash the entire subject over again.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.