Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author benohead

    (@benohead)

    There is no hook in WordPress called at the beginning of the page. Since the themes handle the transition between the <head> tag and the <body> tag, you cannot handle it in a cross-theme way with hooks.

    That said, one way to do this is to use some jQuery to modify the page once it’s loaded (injecting the ad block as the first child of <body>). It is only difficult to figure out how it would look like in all themes since most themes have different levels of containers in the page, and this would then be displayed outside of all of this.

    I’ll give it a try. I just cannot promise it will look good with your theme.

    Plugin Author benohead

    (@benohead)

    I’ve implemented in version 0.9. Please give it a try and let me know whether it works for you.

    In the end I didn’t go for a JavaScript solution but buffer the output of the page and then inject the ad block before it’s rendered.

    Thread Starter massimod

    (@massimod)

    Many thanks, seems to work just great.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Request: Ad slot before the header’ is closed to new replies.