• Resolved davecoledave

    (@davecoledave)


    Hello, I want modify Post title in telegram message. On my website there is title:
    Sachin Tendulkar Tshirt Buy Price at Rs. 500

    I want to send only Sachin Tendulkar Tshirt in Telegram as Title. How can I remove rest parts?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Irshad Ahmad

    (@irshadahmad21)

    Hello

    It requires some custom code. Here is an example:

    add_filter( 'wptelegram_p2tg_post_data_post_title_value', function ( $value, $post ) {
        $value = preg_replace( '/\sBuy\sPrice.+/', '', $value );
        
        return $value;
    }, 10, 2 );
    Thread Starter davecoledave

    (@davecoledave)

    Should I paste this on Message Template box?

    Plugin Author Irshad Ahmad

    (@irshadahmad21)

    No, it’s PHP code. You can add it ti functions.php of your child theme.

    Thread Starter davecoledave

    (@davecoledave)

    after that I have to use {post_title} in Message Template box?

    Plugin Author Irshad Ahmad

    (@irshadahmad21)

    Yes

    Thread Starter davecoledave

    (@davecoledave)

    but in this way we online can cut the value after Buy Price.

    How can I cut multiple values. Like Buy Price, Sell, Big Deal etc?

    Plugin Author Irshad Ahmad

    (@irshadahmad21)

    That is just an example. You can update the code as per your needs.

    Thread Starter davecoledave

    (@davecoledave)

    can you please give me example of multiple values? Because I am not an expert in coding. I googled but there is different different codes. If possible please provide me example for multiple values.

    Plugin Author Irshad Ahmad

    (@irshadahmad21)

    Here is such an example

    add_filter( 'wptelegram_p2tg_post_data_post_title_value', function ( $value, $post ) {
        $value = preg_replace( '/\s(Buy Price|Big Deal|Sell).+/i', '', $value );
        
        return $value;
    }, 10, 2 );
Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.