How to set default value for ‘Alt text’ on image upload dialog?

Ok, the answer will not be short At first, You can’t change the alt attribute using attachment_fields_to_edit, because you can’t modify default fields. To see how this works can be in the source code of get_compat_media_markup. With attachment_fields_to_edit you can add only additional input fields. Example: /** * Add custom field for Images * * … Read more

How to get all attachment image from post ?? WordPress

<?php /* * Template Name: Gallery Page */ $query_images_args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => – 1, ); $query_images = new WP_Query( $query_images_args ); ?> <?php get_header();?> <div class=”main”> <div class=”row”> <?php foreach ( $query_images->posts as $image ) {?> <div class=”col-md-3″> <img src=”<?php echo wp_get_attachment_url($image->ID); ?>” > <a … Read more

Add custom field to media attachment image attribute in post editor

I wonder if you want to modify the HTML of the inserted image, with the image_send_to_editor or get_image_tag filters? If that’s the case, then here’s one example: /** * Add the data-ext-link-title and data-ext-link-url attributes to inserted images. */ add_filter( ‘image_send_to_editor’, function( $html, $id, $caption, $title, $align, $url, $size, $alt ) { if( $id > … Read more

Saving Custom Field in Attachment Window in WordPress 3.5

I wanted to be able to add author information to my attachments and merged this code: http://www.billerickson.net/wordpress-add-custom-fields-media-gallery/ with the one you refer to. I Got it to work fully in the modal window via AJAX. The modified code is as follows: /** * Add Author Name and URL fields to media uploader * * @param … Read more

Thickbox hacking – removing fields

Tricky but once you understand how WordPress sets the sizes and the fields then the rest is easy: function thickbox_fields($form_fields, $post){ unset( $form_fields[‘post_title’], //disables “Title” field and so forth… $form_fields[‘url’], $form_fields[‘image_alt’], $form_fields[‘post_excerpt’], $form_fields[‘post_content’], $form_fields[‘align’], $form_fields[‘image-size’] ); //create the size input for full only and set display to none $size=”full”; $css_id = “image-size-{$size}-{$post->ID}”; $html = “<div … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)