Skip to content

Instantly share code, notes, and snippets.

@richardtape
Created November 1, 2012 10:34
Show Gist options
  • Save richardtape/3992981 to your computer and use it in GitHub Desktop.
Save richardtape/3992981 to your computer and use it in GitHub Desktop.
Possibly fixing the crappy shortcode in the "RAD" dropbox thing for @MrQwest
<?php
extract(shortcode_atts(array("dir" => $directory, "button" => 'Upload To Dropbox!'), $atts));
$rad_dropbox_settings = admin_url( 'admin.php?page=rad_dropbox_settings', '' );
if (empty($wp_settings_check)) { echo '<div class="message-yellow">You must enter your Dropbox account details first! Please go to the <a href="'.$rad_dropbox_settings.'">settings</a> page!</div><br>'; }
echo $message; ?>
<?php
$output = '<form method="POST" enctype="multipart/form-data" class="rad-dropbox-uploader">';
$output .= '<input type="hidden" name="dest" value="$dir" />';
$output .= '<div class="rad-dropbox-file">';
$output .= '<input type="file" name="file" class="rad-dropbox-file" />';
$output .= '</div>';
$output .= '<div class="rad-dropbox-button">';
$output .= '<input type="submit" value="$button" class="rad-dropbox-button" />';
$output .= '</div></form>';
return $output;
?>
Replace the file /inc/shortcode.php with everything above. The problem is, WordPress shortcode functions expect you to *return* something (which is then output by WP). The function above actually echoes out stuff which is why it's appearing at the top of the page rather than where the shortcode is run.
Entirely untested, but hopefully you get the idea.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment