WordPress.org

Ready to get started?Download WordPress

Forums

[Twenty Twelve] Post issue (7 posts)

  1. brandcaul
    Member
    Posted 1 year ago #

    Hi guys,

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

    http://i961.photobucket.com/albums/ae96/Brandcaul/MoreCreativeAdvertising-ADDBlog_zpsbbd80f2d.png

    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!

  2. Andrew Nevins
    Barrel Rider, Spam Zapper & Volunteer Moderator
    Posted 1 year ago #

    What's supposed to happen?

  3. brandcaul
    Member
    Posted 1 year ago #

    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?

  4. Andrew Nevins
    Barrel Rider, Spam Zapper & Volunteer Moderator
    Posted 1 year ago #

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

  5. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

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

  6. brandcaul
    Member
    Posted 1 year ago #

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

  7. brandcaul
    Member
    Posted 1 year ago #

    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%;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.