• Resolved ch8rt

    (@ch8rt)


    Two questions in one day. ??

    I’m trying to get attached files to output, but using the regular line of code at best just supplies an id.

    <?php echo slt_cf_field_value( 'product-image-1' ); >

    I can see in your documentation there is a type declaration for attachment. But it seems to have no effect on the above. Any pointers?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Steve Taylor

    (@gyrus)

    Yeah, I decided it’s best to store the ID, then what you do with files on output (especially images) is more flexible. You need to look at something like:

    <?php echo wp_get_attachment_image( slt_cf_field_value( 'product-image-1' ) ); ?>

    See https://codex.www.ads-software.com/Function_Reference/wp_get_attachment_image and the other attachment functions listed at the end of that page.

    The “attachment” type you’re looking at is probably a “box type”, i.e. it says that the “box” of fields being defined is to be included on the attachment edit screens (not post or user edit screens). The “box” concept is a bit redundant for attachment and user fields, but the code started life just dealing with post edit screen meta boxes.

    Thread Starter ch8rt

    (@ch8rt)

    Super fast reply, thanks Steve.

    I was stuck in your plugin documentation then, rather than thinking about WP functions. ?? Doh!

    ta.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Outputting files / images’ is closed to new replies.