Support » Plugins » Hacks » Make plugin page follow standard enqueueing procedures

  • I am writing an administrator plugin that helps a user write some simple shortcodes. When the user clicks on a new button in the TinyMCE editor a ThickBox window appears and loads a PHP template I created with a heap of prompting fields.

    If I want to access new scripts or stylesheets in this window I have to hard code them into the PHP template. I.e.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <title></title>
            <script src="./scripts/myscript.js"></script>
            <style src="./css/mystyles.css"></style>
        </head>

    I would much prefer to use best practice enqueuing methods as opposed to this method.

    Is there a way to make this PHP document in my plugins folder do all the normal WordPress processes (e.g. enqueue script and styles) as if it were just another page?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Sorry for the late reply. To enqueue scripts and styles and do all the other WordPressy things that happen on a page, call wp_head() just before the closing </head> tag.

Viewing 1 replies (of 1 total)
  • The topic ‘Make plugin page follow standard enqueueing procedures’ is closed to new replies.