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


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


8

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


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


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


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


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


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

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


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

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!


2

You can use the exclude parameter. global $post; $args = array( 'exclude' => get_post_thumbnail_id( $post->ID ) 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_parent' => $post->ID ); $images = get_posts($args); ...


2

You're using get_the_post_thumbnail() and not the nonexistent get_post_thumbnail() function, right? As JohnG said, you have to pass the ID of the current post to get_the_post_thumbnail() (the the_post_thumbnail() function already handles that for you). The Function Reference in the WordPress Codex has many usage examples: get_the_post_thumbnail($id); ...


2

If you look here: http://codex.wordpress.org/Function_Reference/the_post_thumbnail you will see that you can change the alt. You have to add an array with the value for the alt in the second parameter like so: <?php the_post_thumbnail('thumbnail', array( 'alt' => false )); ?>


2

The "medium" and "large" are not custom image sizes - they are already part of the core WordPress media sizes and they should be handled via the "settings" -> "media" options page in wp-admin. Give your custom image sizes a different and more unique name (reserved are thumbnail, medium, large, full)


2

You can try something like this: <!-- The Post Thumbnail function is active by default, but this line of php will make it display.--> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" target="_blank"><?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { ...



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