• The theme doesnt seem to let image caption resize with the image size. The inserted image either sticks out of the caption or the caption doesn’t fit and is too wide for it…
    I also noticed that I cannot resize the image sizes somehow…? they stay at that restricted format…

Viewing 4 replies - 1 through 4 (of 4 total)
  • edit style.css of TwentyTen, find:

    #content img {
    margin: 0;
    height: auto;
    max-width: 640px;
    width: auto;}

    remove width: auto;

    I am also not being able to resize images from within the html image tag.
    The above solution does not seem to help.

    Put the code of this page in your functions.php https://www.transformationpowertools.com/wordpress/adjust-caption-frame-width here is the explanation and the solution of your problem.

    The code:

    add_shortcode('wp_caption', 'slim_img_caption_shortcode');
    add_shortcode('caption', 'slim_img_caption_shortcode');
    function slim_img_caption_shortcode($attr, $content = null) {
     // Allow plugins/themes to override the default caption template.
     $output = apply_filters('img_caption_shortcode', '', $attr, $content);
     if ( $output != '' )
     return $output;
    
     extract(shortcode_atts(array(
     'id'    => '',
     'align'    => 'alignnone',
     'width'    => '',
     'caption' => ''
     ), $attr));
    
     if ( 1 > (int) $width || empty($caption) )
     return $content;
    
     if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
    
     $frame_width = 0; // frame width in pixels per side //
    
     return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="width: ' . ( 2 * $frame_width + (int) $width) . 'px">'
     . do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>';
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Image captions don't work with dimension’ is closed to new replies.