$item2['menu_order']; }); // Bail if no fields if (! $fields) return $content; // If we have fields add them to the end of the content // Buffer the output ob_start(); $post_id = get_the_ID(); // Render each field foreach( $fields as $field ) { acfd_render_field( $post_id, $field ); } // Get the HTML $form = ob_get_contents(); ob_end_clean(); // Return the content and out fields return $content . $form; } /** * Render the given field * Adds a wrapper around the field value */ function acfd_render_field( $post_id, $field ) { // Don't render some field types if ( $field['type'] == 'password') { return; } ?>
"; } // ID if ($return_format == 'id') { // Render the image $image = wp_get_attachment_image( acfd_get_array_value('value', $field), 'medium'); } // Array if ($return_format == 'array') { // Get the value array $value = acfd_get_array_value('value', $field); // Render the image $image = wp_get_attachment_image( acfd_get_array_value('id', $value), 'medium'); } // Bail if no image if (! $image) return; $allowed_html = ['img' => [ 'src' => true, 'srcset' => true, 'sizes' => true, 'class' => true, 'id' => true, 'width' => true, 'height' => true, 'alt' => true, 'align' => true, 'loading' => true, ]]; ?>
Download