Home › Forums › General Issues › 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:
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.
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.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.