WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I added a button and when you press on it new content should come up on top of everything, but if I icnlude my code into header.php it will cover only header, if I include in index.php it will cover only index, so my question is where I should include my code?

share|improve this question

If you want to echo something extremely early, you can do that at template_redirect hook that runs before any template is processed. However that will effectively put output outside of proper markup and so markup produced will be invalid.

I do not quite understand why you need to actualyl output it early, if presentation is controlled with JavaScript (I assume?). You could as well echo it at end of page hidden and position/show when and how is needed on button pressed.

share|improve this answer

I guess what you need is wp_register_script() + wp_enqueue_script()

Are you talking about PHP or JavaScript??? Your description is simply not sufficient.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.