I want to create a header.php file in my child theme and add a line of code. I know I can simple copy and paste the enitre header.php file and then add lines of code but that seems wrong to me. Should I be writing hooks instead. Here is the line of code and the line of code I want to add.
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<img src="<?php echo esc_attr( $logo ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" id="logo" />
<p id="slogan"><?php bloginfo( 'description' ); ?></p>
All I want to do is insert the slogan line of code above the first line of code. Can I write a hook to do this? Please send the code as I don't know how to write hooks but want to learn.