How to add html code to wordpress Header and Footer

To add html code to the header, use the following code snippet

add_action('wp_head', 'add_html_to head');
function add_html_to head(){
  echo "HTML code goes here";
}

To add html code to the footer, use the following code snippet

add_action('wp_footer', 'add_html_to_footer');
function add_html_to_footer(){
  echo "HTML code goes here";
}

These functions can be called from funstions.php in the theme directory or from a plugin.

0