Tag Info

Hot answers tagged

17

You can use the oEmbed functionality baked into WordPress. Typically any video host on this list will return a thumbnail to you using oembed. Here is a list of default providers that WordPress uses for auto embedding in the content area. I've included non-video sources as well for the convenience of others. http://www.youtube.com/oembed ...


11

When an image is uploaded in WordPress, it is saved in its original size, and also in some resized copies in different sizes, in this way became easy use different size of the same image for different purposes. By default, WordPress, create 3 copies in 3 different size: 'thumb' 'medium' 'large' The size in pixel for these 3 sizes can be setted in ...


8

New WP (3.3+) uses plupload, which we now fully integrated into RW Meta Box. Examples The basic meta box before any file was via drag & drop. Plupload during upload - Status "loading/error" have background images for a clean UI. The "Uploaded Images" title appears only on demand. Customize The "TITLE string" headline (hndle bar) can be set ...


5

You can turn your snippet into a function that returns the post thumbnail URL of a post: function wpse81577_get_small_thumb_url( $post_id ) { $thumbSmall = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'small' ); return $thumbSmall['0']; } Usage, supplying the ID of a post: <?php echo wpse81577_get_small_thumb_url( 59 ); ...


5

To built on Max Yudin's answer you should use the intermediate_image_sizes_advanced filter, and not image_size_names_choose. function add_image_insert_override($sizes){ unset( $sizes['thumbnail']); unset( $sizes['medium']); unset( $sizes['large']); } add_filter('intermediate_image_sizes_advanced', 'add_image_insert_override' ); Another easier ...


4

You can also filter intermediate_image_sizes with an empty array. add_filter( 'intermediate_image_sizes', '__return_empty_array' );


4

I have just achieved the effect by my own. I will post it here in case others find this thread: jQuery(document).on('click','.thumbnails .zoom', function(){ var photo_fullsize = jQuery(this).find('img').attr('src').replace('-100x132',''); jQuery('.woocommerce-main-image img').attr('src', photo_fullsize); return false; }); ...


4

Figured it out after a lot of trial and error and a lot of var_dumps. $image = wp_get_image_editor($file); if ( ! is_wp_error( $image ) ) { $image->resize( $width, $height, true ); $final_image = $image->save( $file ); } Then i can use the $final_image array to get what i need. It actually saved me a step from what i was doing and seems ...


4

add_filter('intermediate_image_sizes_advanced', 'filter_image_sizes'); function filter_image_sizes( $sizes) { unset( $sizes['thumbnail']); unset( $sizes['medium']); unset( $sizes['large']); return $sizes; }


4

I believe your issue is that the value set for the global $content_width variable (which is 640px in Boilerplate and 584px in Twenty Eleven) is less than the width you're specifying via Settings -> Media. WordPress is overriding your user setting with the Theme-specific value. This actually makes sense, since a Theme knows its maximum content width, and ...


3

You can use this plugin Wordpress Video Plugin and edit the code of this plugin and add the other sites in it. OR You have to integrate FFMPEG in wordpress.


3

Since you already know your $post_image_id, you can use wp_get_attachment_src() $small = wp_get_attachment_src($post_image_id, 'smallest-size'); $large = wp_get_attachment_src($post_image_id, 'full'); $smallURL = $small[0]; $largeURL = $large[0]; where 'smallest-size' is the name of the image-size you have predefined in add_image_size()


3

There's a lot going on here. First off, you should store the repeater field image as an ID (that probably requires changing how the subfield's setting and possibly re-uploading some of your images) and then use all the WordPress Core API functions to handle it. (You'll probably cross paths with wp_get_attachment_image_src.) That gets rid of your regex-ing, ...


3

You can get the featured image src/source by using the following arguments on the core function (where $post, should be called with global $post in front): wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); How-to use it I wrote a free plugin available on GitHub, called "Dynamic Image Resize". You can download ...


3

Isn't it because you're using $crop as true, as the 4th parameter for the add_image_size() function? This will crop the image and does not actually resize the image.


3

Built in Just set the sizes you don't need to 0. This skips the process of creating them. I know, it's not documented, but it works.


3

Just filter admin_post_thumbnail_html and append your checkbox HTML: add_filter( 'admin_post_thumbnail_html', 'wpse_71501_thumbnail_options' ); function wpse_71501_thumbnail_options( $html ) { return $html . <<<html <p> <label for="big_thumbnail"> <input id="big_thumbnail" name="big_thumbnail" type="checkbox" /> ...


3

The first argument that get_previous_post and get_next_post is $in_same_cat. WordPress is looking for post of the same type in the current posts category. If your custom post type doesn't support the category taxonomy, both functions are likely to return nothing for the previous and next post. Try calling both functions without arguments for your custom ...


3

You need to use the_post_thumbnail instead of the_thumbnail within the loop. This is how it should be formatted: <?php if(have_posts()){ while(have_posts()){ the_post(); if(has_post_thumbnail()){ the_post_thumbnail(); } } }?>


3

the_permalink() is actually filtered in the Recommended Links plugin to echo a custom meta field called _href. If you want access to that field without echoing it, you can use get_post_meta( $post->ID, '_href', true ). Try something like this in your loop: global $post; // may or may not be necessary $url = get_post_meta( $post->ID, '_href', true ); ...


3

Answers: Try this plugin which uses the ffmpeg library This video conversion plugin looks quite promising with wide range of format support Hope it helps. Thanks!


3

This should get you started: Loop over all posts and build an array of linked image files Loop over all image attachments & cross check if any of them have been linked to Might need to batch it or boost the timeout & memory limit, depending on the server & number of posts you're working with. $posts = get_posts( array( ...


3

I use a plugin called Avatar Manager for that function. The author has also done a tutorial on how to write your own avatar manager plugin, but unfortunately it is also a bit outdated and doesn't work anymore. Although the plugin states it is compatible up to 3.6.1, it is still working in 3.8.1. I know at this stage the plugin is maintained as I just ...


3

If I remember right you have to unset all the defaults and add the new Size there: <?php function mxdCustomImageSizes($sizes) { unset( $sizes['thumbnail']); unset( $sizes['medium']); unset( $sizes['large']); unset( $sizes['full'] ); $myimgsizes = array( 'full-size' => __( 'Full Size' ) ); if( !empty($sizes) ) ...


3

When the first image is a Wordpress image attachment. in 3.6, there is an easier way. function get_first_image_medium_size_url($post_id) { if(!$images = get_attached_images($post_id)) return false; $first_image = current($images); if(!$src = wp_get_attachment_image_src($first_image->ID,'medium')) return false; $medium_url = ...


3

JavaScript solution As the original answer already work with string replace, but has to get altered for each and every use case, here's a solution using a fast Regex .test() wrapped up in a self invoking function that uses the default method to prevent events (like following links) from happening. This plugin will delete the first occurrence of any 2-4 ...


2

Displaying images from your galleries is going to be labor intensive. "Galleries" are saved as shortcodes in the post body so you would need to: Query your database for posts containing a gallery shortcode Process the post content of the result set to extract the ids of the gallery images And then use those ids to retrieve the images themselves. There ...


2

http://codex.wordpress.org/Class_Reference/WP_Image_Editor http://codex.wordpress.org/Function_Reference/wp_get_image_editor $image = wp_get_image_editor( 'cool_image.jpg' ); if ( ! is_wp_error( $image ) ) { $image->rotate( 90 ); $image->resize( 300, 300, true ); $image->save( 'cool_image.jpg' ); } Repalce cool_image.jpg with a ...


2

You will need to grab the image, get its ID, and then use wp_get_attachment_image to pick the appropriately sized image. function first_image_medium_wpse_97658($content) { global $wpdb; $pattern = '|<img.*?src="([^"]+)".*?/>|'; preg_match($pattern,$content,$matches); if (!empty($matches[1])) { $path = pathinfo($matches[1]); if ...


2

Your theme has not registered support for post thumbnails. You need to add one of these as appropriate: add_theme_support( 'post-thumbnails' ); add_theme_support( 'post-thumbnails', array( 'post' ) ); // Posts only add_theme_support( 'post-thumbnails', array( 'page' ) ); // Pages only add_theme_support( 'post-thumbnails', array( 'post', ...



Only top voted, non community-wiki answers of a minimum length are eligible