New Landing How can we help? Cardinal Images Appearing Larger than Set

Viewing 7 posts - 1 through 7 (of 7 total)
  • Posted in: Cardinal
  • #162076
    ovollc
    Member
    Post count: 48

    I’ve got a strange issue. Can’t seem to figure this out. I’ve disabled all plugins, and that is not it.

    I’ve got image DIVs that are appearing 10px larger than what they are set to. (see attached code screenshots of code in WP editor as well as what appears in the HTML). This makes my caption larger than the image.

    There seems to be some type of inline style that is inserted somehow/somewhere. Is this the doing of the theme?

    Please reference the image/code in there attachments and in the link.

    Any help you could give would be greatly appreciated.

    Attachments:
    You must be logged in to view attached files.
    #162099
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please use this custom css code:-

    div#attachment_1423{
    width:230px !important;
    }

    Thanks
    Mohammad

    #162403
    ovollc
    Member
    Post count: 48

    Mohammad,

    That will only address that very specific image. This is happening with ALL of the images!?

    #162425
    ovollc
    Member
    Post count: 48

    I have tried something like this:

    
    .wp-caption-text {
        padding: 10px;
        font-family: "Merriweather Sans",Arial, Helvetica, sans-serif;
        font-size: 12px;
        line-height: 18px;
        letter-spacing: 0;
        font-weight: 300;
        font-style: normal;
        text-align: left;
        background: #f6f6f6;
        margin-right: 10px;
    }

    Which fixes the smaller images, but the full width images are then indented

    Attachments:
    You must be logged in to view attached files.
    #162428
    ovollc
    Member
    Post count: 48

    I found this, and it looks to be the same issue that I am having:
    http://troychaplin.ca/2012/fix-automatically-generated-inline-style-on-wordpress-image-captions/

    #162429
    ovollc
    Member
    Post count: 48

    Ok, well, I figured it out. Seems this is an issue with WordPress core. You can fix by adding the following to your functions.php

    add_shortcode('wp_caption', 'fixed_img_caption_shortcode');
    add_shortcode('caption', 'fixed_img_caption_shortcode');
    function fixed_img_caption_shortcode($attr, $content = null) {
    	// New-style shortcode with the caption inside the shortcode with the link and image tags.
    	if ( ! isset( $attr['caption'] ) ) {
    		if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {
    			$content = $matches[1];
    			$attr['caption'] = trim( $matches[2] );
    		}
    	}
    
    	// 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) . '" ';
    
    	return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="width: ' . $width . 'px">'
    	. do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>';
    }
    #162450
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Ok great, glad you managed to solve it

    – Kyle

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register