Support

Account

Home Forums General Issues Some Custom Fields don't show up

Solving

Some Custom Fields don't show up

  • Hi

    I am using the ACF for a longer time and never had this problem before.

    I created 3 field-groups, one with an image and the other two with an text and a number inside.

    All the custom fields are used inside custom post types like portfolio or team. The image is used inside the portfolio post and works very well. The text and number should be displayed inside the team posts but they doesn’t show up.

    Here is the code I am using:

    $output .=
                '<div class="skills">
                    <ul>
                        <li>
                            <div class="skills-text">' . the_field('skill1') . '</div>
                            <div class="progress">
                                <div class="progress-bar stretchRight" style="background-color:#911818; width:' . the_field('progress1') . '%;" role="progressbar" aria-valuenow="' . the_field('progress1') . '" aria-valuemin="0" aria-valuemax="100">
    	                        </div>
                            </div>
                        </li>
                        <li>
                            <div class="skills-text">' . the_field('skill2') . '</div>
                            <div class="progress">
                                <div class="progress-bar stretchRight" style="background-color:#911818; width:' . the_field('progress1') . '%;" role="progressbar" aria-valuenow="21" aria-valuemin="0" aria-valuemax="100">
    	                        </div>
                            </div>
                        </li>
                    </ul>
                </div>';

    I triple checked the name I put in and it’s correct.

    I put the section team with a shortcode in my wordpress page, the code above is a part for that shortcode.

    Does anyone had a similar problem or know what the problem could be?

    Thanks for everything

    Sorry for my english, it’s not my native language

  • Hi Bauralex,

    You need to use get_field() instead of the_field() as you are building a string, not printing to screen.

  • Hi thanks for your suggestion but I’ve already tried this one and it’s not working either.

    I think the problem could be that I am using the_field() in a foreach loop and that ACF has a little problem with that. In another place on my site I created a custom field and it worked.

    I wrote ACF support about the problem and they are on it. So if a get a solution I will post ist here.

    Alex

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

The topic ‘Some Custom Fields don't show up’ is closed to new replies.