• Resolved joelyorca

    (@joelyorca)


    Surely this has a built in way to attach media the page or post it’s being called in? Is there a pro version or something, which is why you would be withholding that ability?

Viewing 7 replies - 1 through 7 (of 7 total)
  • No there is no pro version, and is no plan for pro version. For custom development, contact from here: https://ximdevs.com/contact-us/

    Thread Starter joelyorca

    (@joelyorca)

    Hi Nazmul, I’m trying to use the id given in the shortcode to an attachments content (description). WP uses the the post_content value given in the array as the description so I thought I’d be able to set this as the id variable.

    In your core functions where you create the $attachment array, I want to use the value here..

    Ive tried 'post_content' => $id with no luck

    Would yo be able to put me in the right track here?

    $id is undefined there. You have to pass $id with dropzone when submitting the data e.g. with ‘sending’ event. Then you will be able to use the id in wp_dz_ajax_upload_handle function.

    Thread Starter joelyorca

    (@joelyorca)

    Where would I configure the sending event? As if doing so in your core functions file the Id wouldn’t be defined.

    Could I call a custom function in the js file, like on success perhaps?

    • This reply was modified 6 years, 9 months ago by joelyorca.

    try something like this in callback

    sending: function(file, xhr, formData) {
        formData.append('id', id_of_dom_here);
    }

    then in wp_dz_ajax_upload_handle function, use

    'post_content' => $_REQUEST['id']

    Thread Starter joelyorca

    (@joelyorca)

    Thanks Nazmul, think I’m very close!

    Is that in a shortcode do you mean? I’ve tried that like this

    <?php echo do_shortcode('[wp-dropzone callback="sending: function(file, xhr, formData) {
        formData.append('id', id_of_dom_here);
    }"]'); ?>

    But I get error.. unexpected id

    • This reply was modified 6 years, 9 months ago by joelyorca.
    • This reply was modified 6 years, 9 months ago by joelyorca.
    • This reply was modified 6 years, 9 months ago by joelyorca.

    Try something like this:

    <?php echo do_shortcode('[wp-dropzone id="myID" callback="sending: function(file, xhr, formData) {formData.append("id", "myID")}"]'); ?>

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Attach to current post’ is closed to new replies.