get title in wordpress code example
Example 1: get post title by post id wordpress
get_post( $post_id )->post_title
Example 2: wordpress get site title
You are not outputting anything to show. You are only assigning blog name to a variable. You need to echo the content. It should be :
Hope this helps :)