Support » Plugin: WP Telegram Pro » send jpg absolute url

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Parsa

    (@parselearn)

    Hello Danilo

    WPTP default sends the featured image to the Telegram.
    Do you use the featured image?
    You do not want the featured image to be sent to the telegram channel?
    Or you want to send featured image with another image (With URL)?

    my images are stored in a custom field with absolute patch from cdn, with the plugin I can send the image but I only see the link and not the image,

    this also happens with mp4 files, stored in custom field, how can I send them?

    Plugin Author Parsa

    (@parselearn)

    For image, You can replace your featured image with custom field of image URL by this code:

    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';
    }

    Append this code to functions.php file of your theme, Replace image_url_custom_field with your custom field key.

    For video maybe added to next version(s).

    • This reply was modified 2 months, 3 weeks ago by Parsa.

    Hello,

    I’m having problems, I added this code to my functions.php

    function wptelegrampro_change_post_image($item, $post_id, $query)
    {
        $image_meta = get_post_meta($post_id, 'https://image.tmdb.org/p/w185/dt_poster', 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

    I checked the option “With featured image?” on yes in the plugin settings, but I can’t see the image. a little help to solve?

    thanks

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