Thumbnail Cropping with add_image_size?

Refer to the add_image_size() Codex entry: <?php add_image_size( $name, $width, $height, $crop ); ?> The $crop parameter is the key: (boolean) (optional) Crop the image or not. False – Soft proportional crop mode ; True – Hard crop mode. Default: false That is: False (default): box-resize – (resize image against the constraining dimension) True: hard-crop … Read more

Can’t get image size set with set_post_thumbnail_size() function

They work independently of eachother. You need to call the one you created in the functions.php. So in your functions.php you would have something like: if (function_exists(‘add_theme_support’)) { add_theme_support( ‘post-thumbnails’ ); set_post_thumbnail_size( 75, 75, true ); // default thumbnail size add_image_size(‘my-custom-thumb’, 80, 80, true); //custom size } and then to call your custom thumbnail you … Read more

Change featured image urls in database

The featured image is stored in the *_postmeta table under the _thumbnail_id key. In fact, chances are that you’ve got a lot of image/media urls in that table, which you haven’t changed. The problem is that a number of things are stored in serialized arrays and changing them with SQL as above will (probably) break … Read more

Allow author to choose his featured image size

You could add a meta box to the post add/edit screen below the featured image box to allow selection of size via a dropdown select menu. You could generate the list from available sizes (via get_intermediate_image_sizes), or just use your small/large strings. The data would be saved as post meta and you would simply get_post_meta() … Read more

Confused with the loop and repeating things

You are not using loop properly. Not tested but you can try this: <?php if (have_posts()) : ?> <br /> <div class=”jumbotron”> <?php while (have_posts()) : the_post(); ?> <?php the_post_thumbnail(array(‘class’ => ‘img-thumbnail’)); ?> <?php endwhile; ?> <br /><br /> <button type=”button” class=”btn btn-xs btn-warning”>VER TODOS LOS ESTRENOS</button> </div> <?php else: ?> <p><?php _e(‘No posts were … Read more

How to get full absolute url for post attachment?

esc_attr() might not be necessary on the url retrieved by wp_get_attachment_image_src. I have referred to a code example from the WordPress Codex page on wp_get_attachment_image_src and adapted the following code that works for me. global $post; $thumbnailSrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), ‘medium’); if ( $thumbnailSrc ) : echo ‘<meta property=”og:image” content=”‘.$thumbnailSrc[0].'”>’; endif; Edit: Since you are using … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)