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 ...


16

When an image is uploaded in WordPress, it is saved in its original size, and also as some resized copies in different sizes. In this way it becomes easy to use different sizes, of the same image, for different purposes. By default, WordPress creates 3 copies in 3 different sizes: 'thumb' 'medium' 'large' The size in pixels for these 3 sizes can be set ...


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 ...


7

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


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

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; }); ...


5

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 ...


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

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

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 ...


4

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


4

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

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 ...


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

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

Notes Solution for YouTube and Vimeo. Uses Featured Image or default thumbnail from video provider. If more than one oEmbed exists in the same page, using the Featured Image provoques duplicate "thumbs". Post has to be updated before changes are seen. To do: <iframe> and <img> sizes, other oEmbeds. Sources of Inspiration oEmbed oEmbed, ...


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

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

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

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

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

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

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

Research The question Filter For Featured Image lead to this answer: How to hook update_post_meta and delete_post_meta?. Coupled with the a fine global variable ($_wp_additional_image_sizes) revealed here: How to get a list of all the possible thumbnail sizes set within a theme, bring us to the code that catches the "Use as featured image" action click. ...


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, ...


2

If you want to ensure your image sizes remain available when switching themes, then you should place them into a plugin. Create a .php file (name it what you want) and place it in wp-content/plugins/, then paste the following: <?php /* Plugin Name: My Custom Image Sizes Plugin URI: http://pippinsplugins.com/ Description: Images sizes to be used in all ...


2

i'm looking for a more discrete and automatic approach. And that is altering the wp_create_thumbnail i think. And that is where you'd be wrong. Here is the entire code for wp_create_thumbnail() from core: function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) { if ( !empty( $deprecated ) ) _deprecated_argument( __FUNCTION__, ...



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