Tag Info

Hot answers tagged

16

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


7

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

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

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

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

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

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

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

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

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

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

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


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


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

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


2

Try the following code inside the loop and modify it as per requirement. $thumb_id = get_post_thumbnail_id(); echo 'Name = '. get_post_field( 'post_name', $thumb_id ).'<br />'; echo 'Alt = '. get_post_meta( $thumb_id, '_wp_attachment_image_alt', true ).'<br />'; echo 'Title = '. get_the_title( $thumb_id ).'<br />'; echo 'Caption = '. ...


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

Seems that the answer is no... I've followed the core functions and found a dead-end. And found this post ( How can I make add_image_size() crop from the top? ) where Rarst says: Intermediate image generation is extremely rigid. Image_resize() keeps it close to code and completely lacks hooks. But, following the lead of the other answer (from bradt) ...


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

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

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

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



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