Hello,
If Single Message option is enabled and Image Position is set to After text, then the link preview will always show the image.
I would suggest to disable Single Message option.
I tried your way but nothing changes.
The message shows link without preview.
BUT! I understand that the preview is blocked only to the direct Amazon’s urls.
If I insert a youtube link (or other site link), the preview show up.
Maybe..
I can try to “create” a preview replacing that with my own image.
How I can insert an attached image?
My customized content type let me create an image-upload field but when I public the post, the telegram bot show “Array” instead of attached image.
OTHER (Off problem) Question: Does the plugin support the customized inline button url for telegram? In the setting I can just replace “View Post” text and not the url attached (this because I want redirect people in another site, not in my created post).
and.. thanks for the quickly reply!
I’m not sure what you mean by
How I can insert an attached image?
Regarding inline button, yes it’s possible to customise it using custom code.
The question is much simpler than it seems. Can I send an image in a telegram message through a custom image-upload field?
Example:
{cf:title_field}
{cf:decription_field}
{cf:image}
Where {cf:image} is a custom field with upload (image only) function.
When I try to send it, Telegram bot doesn’t show attached image.
I want it like a “cover image”.
Regarding inline button, should I edit the plugin code? Can you tell me which file exactly?
To use a different image instead of featured image, you can use this code:
/* WP Telegram - use custom image */
add_filter(
'wptelegram_p2tg_post_data_featured_image_url_value',
function ( $image_url, $post ) {
// get the image URL from "image" meta key
$image_url = get_post_meta( $post->ID, 'image', true );
return $image_url;
},
10,
2
);
/* WP Telegram - use custom image */
To customize the inline button, here is a sample:
/* WPTelegram Modify default inline button */
add_filter(
'wptelegram_p2tg_default_inline_button',
function ( $button, $post ) {
// set the URL of your choice
$button['url'] = urldecode( get_permalink( $post->ID ) );
$button['text'] = 'Read Online';
return $button;
},
10,
2
);
/* WPTelegram Modify default inline button */
Note: You should NEVER edit the plugin code. You can add the above code to functions.php of your active/child theme.
Ok, thank you. Let me try. I’ll update you as soon as possible!
I think I did something wrong:
Inserted the first code in function.php.
Recreated custom field named “image” (Type field: upload).
Inserted the code {cf:image} in the P2TG settings template.
Tried to public a post.
Telegram Bot shows “Array” where the image should be.
What if I try to insert an HTML code in the P2TG template like <img src="{cf:image}" />, where {cf:image} is an url field?
I apologize for my poor skill
Regarding inline button, I need to replace this:
$button['url'] = urldecode( get_permalink( $post->ID ) );
with this:
$button['url'] = url from custom field (a textbox);
But I’m trying several codes without a good response.
Maybe the plugin that I’m using for creating custom post and fields is not good..
That’s the sample code, you need to figure out the rest based on your set-up and custom field configuration. The code for image is to replace sending of featured image, you don’t need to add anything to template