• Hello Parsa,

    I’m trying to replicate your solution shown in this post but it doesn’t work.

    add_filter('wptelegrampro_post_info', 'wptelegrampro_change_post_image', 999999999, 3);
    
    function wptelegrampro_change_post_image($item, $post_id, $query)
    {
        $image_meta = get_post_meta($post_id, 'image_url_custom_field', true);
        if ($image_meta){
            $item['image'] = $image_meta;
            add_filter('wptelegrampro_image_send_mode', 'wptelegrampro_image_send_mode', 999999999);
        }
        return $item;
    }
    
    function wptelegrampro_image_send_mode($mode)
    {
        return 'image';
    }

    This url is absolute and valid for all images:

    https://image.tmdb.org/p/w185

    dt_poster is the key to the custom field, example value:

    /5wy8dkl7SYuYvVDLmnvflf1JRSz.jpg

    I checked the option “With featured image? can you offer help?

    Thanks

    • This topic was modified 4 years, 8 months ago by Branko.
    • This topic was modified 4 years, 8 months ago by Branko.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Parsa

    (@parselearn)

    Hello
    Your meta value needs valid URL, For example:
    https://image.tmdb.org/5wy8dkl7SYuYvVDLmnvflf1JRSz.jpg

    And replace image_url_custom_field with your meta key.

    Thread Starter Branko

    (@lookiz)

    the value is valid, the custom field is, example: /5wy8dkl7SYuYvVDLmnvflf1JRSz.jpg

    this part is fixed/absolute, not in the custom filed, maybe you didn’t understand my question?
    https://image.tmdb.org

    Plugin Contributor Parsa

    (@parselearn)

    You need to concat/add custom field value to base URL:

    function wptelegrampro_change_post_image($item, $post_id, $query)
    {
        $image_meta = get_post_meta($post_id, 'image_url_custom_field', true);
        if ($image_meta){
            $item['image'] = 'https://image.tmdb.org' . $image_meta;
            add_filter('wptelegrampro_image_send_mode', 'wptelegrampro_image_send_mode', 999999999);
        }
        return $item;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Featured image to custom field’ is closed to new replies.