• When I edit the ‘single listing content markup’ in the settings, everything appears fine except that custom field data won’t display in the output. I’ve tried it with both Advanced Custom Fields enabled and disabled, using both the sample format shown in the editor and ACF shortcodes, but no dice. It’s basic text fields, nothing complicated. Any idea what’s going on?

Viewing 1 replies (of 1 total)
  • Same for us, here’s what we found out if someone wants to debug further:

    FILE favorites/app/Entities/FavoriteList/FavoriteListingPresenter.php FUNCTION private function replaceCustomFields()

    $meta = get_post_meta($this->favorite, $key, true);

    doesn’t work. When we changed to ACF model:

    $meta = get_field( "$key", $this->favorite);

    we were able to get the first value when using shortcode [our_custom_field], if our ACF field was named car we’d use [car] or named field_cars [field_cars].

    We ended up hardcoding the shortcodes like this:

    private function replaceCustomFields() {
    $field = get_field( "our_custom_field", $this->favorite);
    $this->html = str_replace('[our_custom_field]', $field, $this->html);
    }

    The issue with original function is (at least):

    – it doesn’t work with ACF
    – when changing to use get_field( "$key", $this->favorite) it only gets the first one

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Fields Not Displaying’ is closed to new replies.