Make plugin page follow standard enqueueing procedures (2 posts)

  1. McShaman
    Posted 2 years ago #

    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">
            <script src="./scripts/myscript.js"></script>
            <style src="./css/mystyles.css"></style>

    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?

  2. bcworkz
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic