Return Value of CustomPress Upload Field

Hi,

I'm using upload field of CustomPress. When I tried to echo the shortcode by using echo do_shortcode('[ct id="some_code_here" property="value"]'), instead of one img tag, I got 4 img tags. My best guess is these are actually thumbnail, medium, large and original version of the uploaded images. So my question is how to get the specified version of the image?

Another question is I can only upload and replace the file of the custom field, but can't delete the uploaded file, or reset the field. Is there a way to do this?

BR

  • Predrag Dubajic
    • Support

    Hey LZ,

    Hope you're doing well today :slight_smile:

    I was unable to replicate the first part of your issue as on my end only one image was shown, could you grant support access to your site so I could compare our setups?
    To enable support access you can follow this guide here:
    http://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Another question is I can only upload and replace the file of the custom field, but can't delete the uploaded file, or reset the field. Is there a way to do this?

    I'm afraid that at this moment there's no way of doing this, I will report this to our developers so they can add remove button in future releases.

    Best regards,
    Predrag

  • Predrag Dubajic
    • Support

    Hi LZ,

    I see that you're using custom Upfront theme, can you tell me how and where did you add the code to display those custom fields?

    With Upfront you can use simple text fields and then add shortcode for your custom fields, like this for example:
    [ct id="_ct_upload_585bde6b62d88" property="value"]

    Best regards,
    Predrag

  • LZ
    • Design Lord, Child of Thor

    Hi Predrag,

    I used theme editor directly to edit the single-product.php in the layout dir because I need to change a background image with the shortcode value. You can view my code also with the theme editor. The shortcode is added to the beginning of single-product.php.

    BR

  • Adam Czajczyk
    • Support Gorilla

    Hello!

    I checked your site and I was able to replicate that on my own setup with another Upfront theme ("Gillie" which is a standard Upfront starter theme). It seems that the shortcode is returning proper data and a single image only but for some reason it's repeated four times (that's the same image).

    Upfront themes and their parts are very unlike any other regular themes and they never should be edited directly. These files are processed in a much different way than files of standard themes and this can lead to unexpected results. I believe though we can find a bit better way to achieve what you are aiming for.

    Could you please then describe in details how would you like that to work? I understand that an image that is added via that custom field should be used as a background of "single-product.php" layout but would that be a background of entire page or just some part of it (like e.g. header), should it be static/fixed full-screen background or should it be scrolled/repeated on page, etc...?

    Let me know please and I'm sure we'll find a working solution for you :slight_smile:

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.