count_posts to a standalone link

You can use wp_count_posts

Example using code above:

$count_posts = wp_count_posts('post');

if ( $count_posts ) {
    $published_posts = $count_posts->publish;
}

<a href="https://wordpress.stackexchange.com/questions/250800/YOUR_LINK">YOUR TEXT <?php echo $published_posts; ?></a>

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