• Resolved JLBA

    (@jltest)


    Hi everyone,

    I’ve created a custom post type with Pods for displaying some Hotels.

    This CPT got photos. When using Pods item list block, photos are correctly displayed.

    I’m trying to display the hotels’ list as a carousel using Smart Slider pro. I create a slider with dynamic content / WP post / hotels CPT. When adding the custom fields : texts are ok but images are blank. In the ouptput code : src="" in <img /> tag.

    What do I miss ?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Robert

    (@robertnextendweb)

    Hi @jltest

    I assume you used the File/Image/Video field type. The problem with this is that this will not return the actual URL of the image, but rather the attachment ID. Unfortunately, we don’t have code specifically for Pods, so we just retrieve the meta data of a post as it is stored, but we can’t go any further than that. So the problem here is that the URL of the image itself has no direct connection to the post, but if you could somehow solve it, for example with a custom plugin or custom code, so that the URL is also saved as meta data, then it could work. Or if it would be possible, you could use the Advanced Custom Fields plugin, which we wrote direct code for the Image field to retrieve the image based on the ID.

    If you insist on using Pods, you could get the images as URLs with custom code. Please note we have no support for custom coding, nor for any problems or questions related to custom coding. We have a “smartslider3_posts_customposts_data” filter that allows you to add custom fields in the custom posts generator. You could use this to convert the attachment ID to an URL. This is an extremely basic solution for that:

    function custom_smartslider3_posts_posts_data($record) {
    $record['image_url'] = wp_get_attachment_image_url($record['hotelimage'], 'full');
    return $record;
    }

    add_filter('smartslider3_posts_customposts_data', 'custom_smartslider3_posts_posts_data');

    Here the field ‘hotelimage’ contains the attachment ID, you will need to use your own field name for that.
    And the image URL would be in the “image_url” variable, so that is what you would insert as the background in the slide.
    Also, like I said, this is a basic solution, and it doesn’t consider other factors, which could cause problems, and you may need to extend on this code to fit your needs, but like I mentioned above, we are unable to help with custom coding, so if you do not want to bother with this, I would rather recommend using the Advanced Custom Fields plugin.

    Thread Starter JLBA

    (@jltest)

    Thanks Robert for your detailed answer. I’d see if there could be a solution to store the url/path inside Pods…

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.