• Resolved Vincent

    (@vincentastolfi)


    Consider dropping this quick function in your main php file so that people without much coding experience can use the plugin with a bit less trouble:

    function jquery_file_upload_shortcode() {
          jquery_html5_file_upload_hook();
    }
    
    add_shortcode ('jquery_file_upload', 'jquery_file_upload_shortcode');

    As for other users having issues with not being able to properly implement this, you can drop the above code in the plugin file named “jquery-html5-file-upload.php” and use the shortcode [jquery_file_upload] to display the file uploader in your content.

    You can even drop this in your theme files (most likely function.php) but you must do the following to ensure that there are no conflicts when the plugin is deactivated:

    //Includes required plugin.php file
    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    
    // Checks if plugin is active, and if it is, it creates the shortcode
    if (is_plugin_active(plugins_url.'/jquery-html5-file-upload.php')) {
    function jquery_file_upload_shortcode() {
          jquery_html5_file_upload_hook();
    }
    
    add_shortcode ('jquery_file_upload', 'jquery_file_upload_shortcode');
    }

    To the author: Please make this change when you get a chance! Thanks for the awesome WordPress edition of a great Jquery plugin!

    To other users: If you have any questions about the code offered above or how to implement it, I’m notified on follow-up so I’m happy to help make clarifications!
    http://ww.wp.xz.cn/extend/plugins/jquery-html5-file-upload/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thank you so much for the reply. This looks like exactly what I was looking for.

    Can you clarify what is the “main php” file to drop in the function? Where do I find it and what will it be named? Also, where do I drop it within that page?

    Would you recommend dropping it in the theme files function.php? Or is it safer to do the first example you provided?

    Thanks again for your help!

    -Phil

    Thread Starter Vincent

    (@vincentastolfi)

    Haha, sorry I thought that might be a bit confusing. The “main php” file I was referencing was that of the plugin (but I was speaking to the plugin author). That file would be the plugin’s “jquery-html5-file-upload.php” file, I was requesting he drop that function in that file and commit his changes as an update to users.

    As for where YOU should put the function for now, that really depends. If you update your theme a lot, that change will go away when you update. The same is true for the plugin, though I’m not sure how often it is updated. If you never update your theme, the second way is safer, and if the plugin is rarely updated then the first option is king.

    -Vincent

    @learnthebeatles->Please refer to the screenshot http://ww.wp.xz.cn/extend/plugins/jquery-html5-file-upload/screenshots/. Also, I request you to install the latest version of the plugin

    @vincent -> Thanks for your input, I have released an updated version and included your suggestion in it

    Setting this thread as resolved

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Add Shortcode Support Please!’ is closed to new replies.