Home › Forums › General Issues › Displaying Array Data in Product Pages › Reply To: Displaying Array Data in Product Pages
I imported all products from csv. They are visible in products admin section. The custom fields had been set up before import and the field values were imported too. The problem I had was displaying those labels (keys) and fields (values) on the products webpage, but only those labels and fields that were not empty. I have over 3000 extremely varied products and 29 fields and only a third of those fields were relative to any one product at any time. However, having spent a lot of time trying to find an answer I managed to sort it out using the following and placed the code in my template. Now all I have to do is complete a php course so it doesn’t take two weeks to find 10 lines of code! Thanks for your responses.
<?php
$fields = get_field_objects(); ?>
<?php if( $fields ): ?>
<?php if( $field[‘value’] ): ?>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
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.