More Fields & Media Upload
Zach, can you post a pastebin or other code to show how you edited? Post in that other forum too, maybe they can incorporate into next version….
Zach, can you post a pastebin or other code to show how you edited? Post in that other forum too, maybe they can incorporate into next version….
You don’t need to do manual cropping; just create a custom image size, and WordPress will perform the cropping on image upload. e.g. in functions.php: add_image_size( ‘portfolio-thumbnail’, 214, 187, true ); Then in your portfolio template, inside the Loop: the_post_thumbnail( ‘portfolio-thumbnail’ ); (I assume you know how to handle the rest of the output, such … Read more
When you upload an image via the media library, additional sizes are created: large, medium, thumbnail, plus any additional sizes defined by plugins or your theme. If your theme displays any sizes other than the original, un-resized image, you’ll have to regenerate those additional sizes to see any changes take effect. If this is the … Read more
Add this to functions.php file. function image_attachment_field($form_fields, $post) { if( substr($post->post_mime_type, 0, 5) == ‘image’ ){ $user = new WP_User( $post->post_author ); $form_fields[“author”][“input”] = “html”; $form_fields[“author”][“html”] = ‘<p><strong>Author:</strong> ‘.$user->display_name.'</p>’; $form_fields[“license”][“input”] = “html”; $form_fields[“license”][“html”] = ‘<p><strong>License:</strong> GPL</p>’; $form_fields[“source”][“input”] = “html”; $form_fields[“source”][“html”] = ‘<p><strong>Source:</strong> BNS</p>’; } return $form_fields; } add_filter(“attachment_fields_to_edit”, “image_attachment_field”, null, 2); This will ONLY add … Read more
I’d say it’s a Database Issue. If it were the actual image it wouldn’t show up. I’ve had the same issue before but with only a few images luckily. I believe it was caused by a database error. I was having issues on the shared server at the time, and imported quite a bit of … Read more
There are multiple actions available. Demo: add_action( ‘upload_ui_over_quota’, ‘wpse_78085_callback’ ); add_action( ‘pre-upload-ui’, ‘wpse_78085_callback’ ); add_action( ‘pre-plupload-upload-ui’, ‘wpse_78085_callback’ ); add_action( ‘post-plupload-upload-ui’, ‘wpse_78085_callback’ ); add_action( ‘post-upload-ui’, ‘wpse_78085_callback’ ); function wpse_78085_callback() { # see wp-includes/media-template.php print ‘<pre>’ . current_filter() . ‘</pre>’; } Result:
You can use CSS attribute selectors to accomplish this without changing anything in the WP Admin or the HTML. A Google search for “css file type icons” comes up with several results, but I’ll explain the basic idea for you here. An attribute selector lets you style any html tag with a matching attribute. There … Read more
When you upload an image, WordPress generates multiple images for each image size, e.g. medium, thumbnail, large etc If you have a lot of custom image sizes you could cut down, but uploading 1 million images is going to take a lot of cpu, even without the resizing. On top of that, each upload generates … Read more
The pdf is itself an attachment post so in wordpress template hierarchy we can create a template named pdf.php Then you can write following code in it which force download the pdf file. <?php if (have_posts()) : the_post(); $pdf_title = $post->post_title; $pdf_src = get_attached_file($post->ID ); $bytes = filesize( $pdf_src ); header(“Pragma: public”); // required header(“Expires: … Read more
$is = get_children(“post_parent=$id&post_type=attachment&post_mime_type=image”); foreach($is as $i) { $url = wp_get_attachment_image_src($i->ID, ‘full’); $caption = $i->post_title); } $id is the id of your post. See http://codex.wordpress.org/Function_Reference/get_children