Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello, do you want to use that image in place of featured image or you want to add its URL in the message?

    Thread Starter kolyayurew

    (@kolyayurew)

    I want to be able to use this image in place of featured image. Or this not possible?

    Using it in place of featured image is possible by custom code:

    /* WP Telegram - use custom image url */
    add_filter(
    	'wptelegram_p2tg_post_data_featured_image_url_value',
    	function ( $url, $post ) {
    		// Make sure ACF is active.
    		if ( function_exists( 'get_field' ) ) {
    			// Get the image ID.
    			$image_id = get_field( 'img', $post->ID );
    			if ( $image_id ) {
    				// Set the image url.
    				$url = wp_get_attachment_image( $image_id, 'full' );
    			}
    		}
    		return $url;
    	},
    	10,
    	2
    );
    /* WP Telegram - use custom image url */
    Thread Starter kolyayurew

    (@kolyayurew)

    I added this in functions.php and use in template
    {cf:img}, but everything remains as before.
    Maybe I’m doing something wrong?

    Thread Starter kolyayurew

    (@kolyayurew)

    I did it differently, and just attached the image to the post, but the image not sent.

    You don’t need to add that to template. Make sure to set some Delay in posting in Post to Telegram settings. 1 minute delay should be fine.

    Thread Starter kolyayurew

    (@kolyayurew)

    Also, such an error happens:
    WP Telegram (Отправка публикаций): Произошла какая-то ошибка!

    Канал Код ошибки Сообщение об ошибке
    -******* http_request_failed cURL error 28: Operation timed out after 20000 milliseconds with 0 bytes received

    Thread Starter kolyayurew

    (@kolyayurew)

    Now my template:

    {post_title}
    
    {post_excerpt}

    Will your plugin add a picture attached to the post (not a custom field)? Or i need to add something to the template {post_img} ?

    Thread Starter kolyayurew

    (@kolyayurew)

    Now everything is working. I just send the attached picture.

    Here is what you need to do after you added that code:

    • Make sure that send Featured Image option is enabled.
    • Set a delay of 1 minute

    If it doesn’t work, please enable both the logs in WP Telegram settings and try again. You can then send the log files from wp-content directory to our support on Telegram.

    I am glad it works ??
    You may write a review for the plugin ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Custom Field Image (ACF Plugin)’ is closed to new replies.