WordPress.org

Support

Support » How-To and Troubleshooting » Should I edit media.php?

Should I edit media.php?

  • In the file media.php line 581 fucntion img_caption_shortcode

    return '<div ' . $id . 'class="wp-caption ' . $align . '" style="width: ' . (10 + (int) $width) . 'px">

    What can I do if I don’t want those 10 extra pixels in the width? I know I can delete it and that’s what I did, but when I update WP, it will be replaced.

    BTW those 10 pixels are render in the div of wach attachment.

    <div id=”attachment_563″ class=”wp-caption aligncenter” style=”width: 310px”>

    The image with is 300 and the width it’s set to 310.

    Is there a better way do it?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I think developers should remove that +10px, I’ve seen many people complaining about it, and i’m too.

    BTW, why there is that “additional 10px” ?

    There’re two workarounds for this:

    Hope these help! Cheers!!

    I changed it as well … here is my version … is a bit annoyin on the left hand side but hey, I live with it … and redo after updating. I’d prefer setting the style somewhere else but nothing have worked so far.

    Line:
    change to:
    226:

    $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title="' . esc_attr($title).'" '.$hwstring.' class="'.$class.'" style="padding-left: 10px;" />';

    653ff :

    return
    '<div ' . $id . 'class="' . $align . '" style="text-align:center;">'. do_shortcode( $content ) . '
    
    <span class="wp-caption-text" style="position:relative;width:'. $width . 'px;padding-left:10px; display:inline-block;text-align:left;">
    <small>' . $caption . '</small>
    </span>
    </div>';
    }

    What this does … gives me a padding and adds a caption left aligned.

    Hey, I think workaround one will be a nice solution to my meddling with media php….

    I think I will fiddle with that in the near future.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Should I edit media.php?’ is closed to new replies.
Skip to toolbar