Support » Themes and Templates » [Twenty Twelve] Post issue

  • Hi guys,

    I have no idea whats happened but if you look at this image

    you’ll see that the images in the post stay left and the writing sort of floats right and works its way around the image.

    I have no idea whats happened and I’m hoping someone might be able to help 🙂

    http://addblog.co.za

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Andrew Nevins

    (@anevins)


    Forum moderator


    What’s supposed to happen?

    Well i place the text under the image like you normally would but no matter what it always pulls it to the right around the images?

    Moderator Andrew Nevins

    (@anevins)


    Forum moderator


    Even if you add clear: left; on the paragraph that is not aligned properly?

    Michael

    (@alchymyth)


    Forum Moderator


    in style.css of your child theme, caused by the formatting of the .pinterest-button class with float:left;

    Is there any way I can fix it without editing the css for the pinterest button?

    Here’s the code I used

    function insert_pinterest($content) {
    	global $post;
    
    	$posturl = urlencode(get_permalink()); //Get the post URL
    	$pinspan = '<span class="pinterest-button">';
    	$pinurl = '<a target="_blank" href="http://pinterest.com/pin/create/button/?url='.$posturl.'&media=';
    	$pindescription = '&description='.urlencode(get_the_title());
    	$pinfinish = '" class="pin-it">';
    	$pinend = '</span>';
    	$pattern = '/<img(.*?)src="(.*?).(bmp|gif|jpeg|jpg|png)"(.*?) \/>/i';
      	$replacement = $pinspan.$pinurl.'$2.$3'.$pindescription.$pinfinish.'<img$1src="$2.$3" $4 />'.$pinend;
    	$content = preg_replace( $pattern, $replacement, $content );
    
    	//Fix the link problem
    	$newpattern = '/<a(.*?)><span class="pinterest-button"><a(.*?)><\/a><img(.*?)\/><\/span><\/a>/i';
    	$replacement = '<span class="pinterest-button"><a$2><a$1><img$3\/></span>';
    
    	$content = preg_replace( $newpattern, $replacement, $content );
    	return $content;
    }
    add_filter( 'the_content', 'insert_pinterest' );

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

    .pinterest-button {
    	position:relative;
    	width: auto;
    	float: left;
    	overflow: hidden;
    }
    
    .pinterest-button img {
    	display: block;
    }
    
    .pinterest-button .pin-it {
    	display: block;
    	width: 105px;
    	height: 105px;
    	background: url('/wp-content/uploads/2012/07/pinterest-badge.png');
    	z-index: 9999;
    	bottom: 25px;
    	right: 25px;
    	position: absolute;
    }
    .pinterest-button .pin-it {
    	display:none;
    }
    .pinterest-button:hover .pin-it {
    	display: block;
    }
    
    .entry-header .entry-title {
        font-size: 36px;
    }
    
    div.sharedaddy .sd-content {
        float: left !important;
        margin: -2px 0 0;
        width: 82.125%;
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Twenty Twelve] Post issue’ is closed to new replies.