WordPress.org

Ready to get started?Download WordPress

Forums

exclude admin_head from certain admin pages? (3 posts)

  1. harknell
    Member
    Posted 7 years ago #

    I have a plugin that needs some javascript to appear in the head of my plugins admin page. It turns out though that the javascript I need conflicts with the usage of the sidebar widgets plugin admin page needed for version of wordpress previous to 2.2 (the 2.2 version of widgets doesn't have a problem with my javascript). I put the javascript into the admin head by using admin_head as the hook, but I can't figure out a way to do a conditional statement to limit the javascript to only appearing if the page is my plugin admin page and not any/every admin page. I know in 2.1 they added a new function to do this, but I want to have the plugin be compatible with 2.0 also, so I'm trying to figure out a way to do this.

    Any ideas? Maybe a different way to add the javascript?

  2. whooami
    Member
    Posted 7 years ago #

    the javascript to only appearing if the page is my plugin admin page and not any/every admin page.

    since you dont always have to have script calls within <head> tags, why not just add the code specifically to the options page you are creating for the plugin..

    Follow?

  3. harknell
    Member
    Posted 7 years ago #

    Duh, apparently I'm not Mr. Javascript. I didn't realize that you could do that. Once I moved it to the actual page it worked fine. Thanks for the tip.

Topic Closed

This topic has been closed to new replies.

About this Topic