WordPress.org

Support

Allow URL field

Viewing 1 replies (of 1 total)
  • Plugin Author Rinat Khaziev

    @rinatkhaziev

    Hey Melanie,

    Sorry for the late reply, busy with my office work.

    This will require some additional coding.

    Shortcode part:
    [fu-upload-form class=”your-class” title=”Upload your media”]
    [textarea name=”caption” class=”textarea” id=”ug_caption” description=”Description (optional)”]
    [input type=”file” name=”photo” id=”ug_photo” class=”required” description=”Your Photo” multiple=””]
    [input type=”text” class=”required” name=”user_url” description=”URL of your blog”]
    [input type=”submit” class=”btn” value=”Submit”]
    [/fu-upload-form]

    PHP part to put in your theme’s functions.php

    add_action( 'fu_after_upload', 'my_fu_after_upload' );
    
    function my_fu_after_upload( $attachment_ids ) {
    	foreach( (array) $attachment_ids as $att_id ) {
    		if ( isset($_POST['user_url'] ) ) {
    			update_post_meta( $att_id, 'user_url', esc_url( $_POST['user_url'] ) );
    		}
    	}
    }

    Note that this is not tested. What it’ll do is to add meta field for each uploaded file with an url.

    I’m currently working on the new version, that’ll allow handling of fields automatically. So if PHP stuff is over your head, I suggest you to wait until the next release.

Viewing 1 replies (of 1 total)
  • The topic ‘Allow URL field’ is closed to new replies.
Skip to toolbar