Hi,
I am showing a list of fans, but for some reason the amount spent by the fan is not shown.
There are cpt's for Fan and FanSpending. In the Fan custom fields there is a field 'fan_profile' which is the key (title + slug) to FanSpending.
There is a test Fan with an existing FanSpending, but it's not shown:
https://www.imgbly.com/ib/lQO02ysOhe
{% set args = { post_type: 'fan', posts_per_page: -1, orderby: 'title', order: 'asc' } %}
{% set posts = mb.get_posts( args ) %}
<table>
<tbody>
<tr>
<th><strong>Fan ID</strong></td>
<th><strong>Name</strong></td>
<th><strong>Profile</strong></td>
<th><strong>Spent</strong></td>
<th><strong>Country</strong></td>
<th><strong>Action</strong></td>
</tr>
{% for post in posts %}
<tr>
<td>{{ post.title }}</a></td>
<td>{{ post.name }}</td>
<td>{{ post.fan_profile }}</td>
<td>{% set spending_args = { post_type: 'fanspending', name: '{{ post.fan_profile }}', numberposts: 1 } %}
{% set spending_posts = mb.get_posts( spending_args ) %}
{% for spending_post in spending_posts %}
{{ spending_post.amount }}
{% endfor %} </td>
<td>{% set country_args = { post_type: 'country', relationship: { id: 'fan-countrydetails', from: post.ID } } %}
{% set country_posts = mb.get_posts( country_args ) %}
{% for country_post in country_posts %}
{{ country_post.post_title }}
{% endfor %}</td>
<td class="middle"><a href="https://domain.com/fan-details/?rwmb_frontend_field_post_id={{ post.ID }}" rel="">[icon name="pencil-alt" style="solid" class="middle2" unprefixed_class="middle2"]</a> <a href="https://domain.com/fan/{{ post.slug }}" rel="">[icon name="eye" style="regular" class="middle2" unprefixed_class="middle2"]</a></td>
</tr>
{% endfor %}
</tbody>
</table>
I'm pretty sure it's a small detail that I'm missing, but can't figure it out.
Can you pls comment?
Thanks, regards,
Eddy