WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
Types Plugin - Custom Thumbnail (3 posts)

  1. petelaud
    Member
    Posted 1 year ago #

    Having a problem all of a sudden retrieving a custom thumbnail image using types_render_field. Here is the code:

    <?php echo(types_render_field('product-photo', array( 'size' => 'printables-thumb'))); ?>

    This currently works until I update the post within WP in any way. Once I update the post, it renders the full size image instead of the custom thumbnail. If I change the 'size' to the default 'thumbnail' thumbnail size it works. I noticed that there are versions of the the WP standard thumbnail sizes on the server with "wpcf" added to the filename, so that may be why they work but not the custom thumbnails. Here is how the code renders on the page before I update the post and then after:

    before:
    <img width="208" height="270" src="https://www.website.com/wp-content/uploads/2013/07/Videos-Sample-208x270.jpg" class="attachment-printables-thumb" alt="" style="" title="">

    after:
    <img alt="https://www.website.com/wp-content/uploads/2013/07/Videos-Sample.jpg" title="https://www.website.com/wp-content/uploads/2013/07/Videos-Sample.jpg" class="attachment-printables-thumb" src="https://www.website.com/wp-content/uploads/2013/07/Videos-Sample.jpg">

    This may correspond with an update of the plugin to the latest version. Also, this happens on the live site, but doesn't seem to happen on my staging version.

    http://wordpress.org/plugins/types/

  2. AmirHelzer
    Member
    Plugin Author

    Posted 11 months ago #

    Looks very strange. I can see that the second case is just not output from Types plugin. Are you sure that the image shortcodes are still there?

    It just looks like you have a static image and not a Types shortcode in the content.

    Maybe try to delete it and paste the shortcode again. Also, see what other plugins you may have added. Anything that filters the 'content' may be involved in this.

  3. petelaud
    Member
    Posted 11 months ago #

    Thanks for responding.

    I'm not using shortcodes. The image is added to the post using a Types Custom Field (Image field). The image is then fetched in the theme using the "types_render_field" code I pasted above. It will render the default WP size thumbnails, but not my custom sized thumbnail "printables-thumb", even though I can see that this custom image was generated on the server. In fact, I can fetch this image by height, just not by size.

    'size' => 'printables-thumb' <--- this doesn't work
    'height' => '270' <--- this does work
    'size' => 'thumbnail' <--- this also works

    It works until I update the post in any way. Like if I go into the post and add a period to the text, it breaks and just gets the full sized image.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic