How to display/register widget only on post pages in custom plugin

Display your widget only on post pages by adding if ( !is_single() or is_page()) { return;} at the start of your Widget’s function widget()

public function widget( $args, $instance ) {
    if ( !is_single() or is_page()) {  return;}

    // rest of code
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)