I
I
Igor2020-06-02 15:18:47
Images
Igor, 2020-06-02 15:18:47

How to display an image field created through the "Smart Custom Fields" plugin?

Hi habr!)

There is a plugin: Smart Custom Fields
I created a group with fields, one of them is an image

print_r( $metadata );

    foreach ( $metadata as $meta ) {
      echo $meta['project-fix__screenshot'];
      echo $meta['project-fix__title'];
      echo $meta['project-fix__price'];
      echo $meta['project-fix__problem'];
      echo $meta['project-fix__solution'];
    }


Everything appears fine except for the image.

  • How to be?
  • Where to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2020-06-02
@qud

As it turned out, it displays the id of the attachment. Displayed the image through the wp_get_attachment_image_url() function Example:
$meta['project-fix__screenshot']

echo '<img src="' . wp_get_attachment_image_url( $meta['project-fix__screenshot'], 'full' ) . '">';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question