Zoker
Zoker

Reputation: 2059

Insert non dynamic content directly after body and into header (Wordpress)

I simply want to insert pure html directly after the body tag.

<div class="just-test">Test</div>

And also jquery and css into the head section.

.just-test { color: #FF000 }

$(".just-test").addClass("another-test);

So I found this example, how to add content via wordpress plugin: How do wordpress plugins add content?

But my question: How can I insert directly after body and in the head section?

Thank you

Upvotes: 0

Views: 391

Answers (1)

lxg
lxg

Reputation: 13107

When you want to insert something into the HTML of a WordPress page, you must do this via hooks (and hope that the theme authors call them, but that's a different topic).

There are hooks to insert content into the <head> section of a page (e.g. wp_head) and into the footer of the <body> area (wp_footer). But there is no hook which would allow inserting something at the very beginning of the <body>.

Upvotes: 1

Related Questions