HTML:
<header>
<!-- I want to add html code here -->
</header>
Function:
function add_html_to_header {
<b> Hello World </b>
}
add_action('','add_html_to_header')
Expected Html results:
<header id="header">
<b> Hello World </b>
</header>
EDIT: Is it possible without using Javascript
?
2 Answers
You can add html to the site head using this function:
// Add scripts to wp_head()
function add_head_html() { ?>
<!-- html goes here -->
<?php }
add_action( 'wp_head', 'add_head_html' );
But if you’re talking about the html element <header>
(as it sounds like from your edits) it sounds like overcomplicating things, but you might want to look at injecting it with jquery into the right spot using a solution such as this:
https://stackoverflow.com/a/9866637/3387817