• Please help me!
    How i can activate a custom plugun

    <?php 
    
    add_action('telegram_parse','telegramcustom_parse', 10, 2);
    
    function telegramcustom_parse( $telegram_user_id, $text ) {
        $plugin_post_id = telegram_getid( $telegram_user_id );
    
        if ( !$plugin_post_id ) {
            return;
        }
    
        if ( $text == '/latestnews') {
    	
    	$args = array( 'numberposts' => '4' );
    	$recent_posts = wp_get_recent_posts($args);
    	$return_message = '';
    	
    	foreach( $recent_posts as $recent ){
    		$return_message .= '['.$recent["post_title"].']('.get_permalink($recent["ID"]).')'.PHP_EOL;
    	}
    	wp_reset_query();
        
           telegram_sendmessage( $telegram_user_id,  $return_message);
        }
    
        return;
    }
    
    ?>
  • The topic ‘How to use a custom plugin?’ is closed to new replies.