Why does WP allow to view and media item as a page

It is desirable because you can modify that page, to introduce extra functionality. e.g.: Comments Meta data custom fields titles descriptions Image EXIF showing geolocation data video/audio players thumbnails of other images attached to the post, e.g. the other pictures in the gallery If it troubles you, you can ‘remove’ the feature, by making an … Read more

Store in media library image uploaded from url

I am afraid the upload through url does not uploads the image on your site server but it just inserts it in to the post so it can not appear in the media library. Through a plugin You can use the Grab and save plugin to achieve what you want but i think you don’t … Read more

Two “the_excerpt” questions

You need to hook into two WordPress filters. function custom_excerpt_length( $length ) { return 20; } add_filter( ‘excerpt_length’, ‘custom_excerpt_length’, 999 ); http://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_length function custom_excerpt_more( $more ) { return ‘[…..]’; } add_filter( ‘excerpt_more’, ‘custom_excerpt_more’ ); http://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_more

Change image name during uploading sequentially

The sequencing part will be handled automatically by wordpress. if you want to change the filename, you can do this : function k99_custom_upload_name($filename) { $info = pathinfo($filename); $ext = empty($info[‘extension’]) ? ” : ‘.’ . $info[‘extension’]; $filename=”put your name here”; return $filename; } add_filter(‘sanitize_file_name’, ‘k99_custom_upload_name’, 10); Because wordpress will handle the sequencing , your files … Read more

wp get attachment image always gives me thumbnail

The real workhorses behind wp_get_attachment_image_src are image_downsize & image_get_intermediate_size. Between the two, they’ll attempt to find the largest image available that fits within the constraints of the required size. The return value of wp_get_attachment_image_src will be: Array( [0] => ‘source of image that best fits’, [1] => ‘width of source image’ [2] => ‘height of … Read more

Using Jetpack carousel w/o creating a gallery [closed]

Adding another better solution: This displays only the first image in a gallery, linked to launch the carousel. You would make that first image, and it’s caption, clearly indicate it as a link to a gallery. Give gallery an HTML ID: <div style=”display:none”> </div> Then add CSS: #gallery-link .tiled-gallery-item { display: none; } #gallery-link .tiled-gallery-item:first-child … Read more

How do I retrieve an image’s width and height using Advanced Custom Fields?

You can get the ID for the attachment with $attachment_id = get_field(‘field_name’);. When you have the ID you can use wp_get_attachment_metadata() to get the info associated with the image in an array. The images width and height are stored in cells named width and height. $attachment_id = get_field(‘field_name’); $metadata = wp_get_attachment_metadata($attachment_id); $width = $metadata[‘width’]; $height … Read more

Mass crop images: Landscape images -> Portrait images

In media settings change: Crop thumbnail to exact dimensions (normally thumbnails are proportional) to unchecked. This will fix the problem on new images. For old already imported images, you’ll need to regenerate them. There are many plugins that can do this. This plugin is well known: http://wordpress.org/extend/plugins/regenerate-thumbnails/

Remove height attribute from wp_get_attachment

This worked for me. function remove_width_and_height_attribute( $html ) { return preg_replace( ‘/(height|width)=”\d*”\s/’, “”, $html ); } and then change wp_get_attachment_image_src( $attachment_id, ‘full’ ); to remove_width_and_height_attribute(wp_get_attachment_image_src( $attachment_id, ‘full’ ));