Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Any jQuery plugin can be used in the frontend as long as it’s enqueued properly. WP uses Plupload as well. I don’t know if it’s been altered from what you can download, I’d try using it first before introducing another copy.

    Be vary careful what you allow to be uploaded. Many sites have been hacked due to weak upload screening.

    Thread Starter Xxxcccc

    (@aquaaa)

    Hi,

    i am wp beginner. Would you give me a Short Sample how it works with included plupload? Which kind of code must be put to my page?
    Thanks

    Moderator bcworkz

    (@bcworkz)

    Sorry, I haven’t tried using Plupload myself (doesn’t work in my Linux installation), so I’m not sure exactly what to do. The following suggestions would apply to any javascript or jquery module you might want to use.

    Start with the documentation for Plupload or whatever module you’re interested in. Ignore any instructions or examples for placing link meta tags or script blocks that load any external code for now. Any short script blocks that contain actual code are OK, just no links. I’ll address this further in a bit.

    You’re mainly looking for instructions on how to setup your HTML. You typically need to place a div container with a specific class attribute on your page. Depending on the nature of the module, a particular HTML structure might be required, such as a ul & li stack for accordion and slider modules. This part is no different in WP than any other web site, other than you’ll probably be editing a template instead of a page.

    Another possibility in WP is to create a shortcode to generate the content. As a beginner, just keep this in mind for the future. You’ll want to hardcode the needed HTML for now.

    Now, back to those external links. When coding for WP, you cannot directly reference external code as the Plupload docs probably illustrate. You must instead “enqueue” the script using wp_enqueue_script(). Additionally, you will not need to directly enqueue standard libraries like jQuery and jQuery UI, etc. WP has these local to the installation and they are already registered. You only need to specify any such dependencies when you enqueue your script. In fact, the Plupload modules are also already registered, but they still need to be enqueued. The difference being you reference the handle instead of the file path when enqueueing.

    I’m sure this handle and registered stuff makes no sense right now. Read the liked article, hopefully things will start to make sense. One issue you will run into with Plupload as registered for WP is which handle to use. If you verify the Plupload paths listed here, you will note a couple mismatches. The various HTML modules apparently have been rolled up into one since the list was last updated. Try using the plain “plupload” handle. Examine the resulting link reference in your page’s source view to confirm there’s a correct reference to the current plupload.full.min.js file. I would suspect the HTML4 and 5 handle variants are no longer valid. The other flash, handler, etc. handles should still be valid.

    Based on these guidelines and the linked articles, go ahead and take a stab at coding everything up. If you’re careful, you should get results. If not, post what you came up with here (or at pastebin.com if it’s long) and someone should be able to set you straight. A link to your upload page would be helpful too, if that’s possible.

    Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plupload in WordPress Frontend’ is closed to new replies.