[Twenty Twelve] Post issue (7 posts)

  1. brandcaul
    Posted 3 years ago #

    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 :)



  2. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

    What's supposed to happen?

  3. brandcaul
    Posted 3 years 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
    Forum moderator
    Posted 3 years ago #

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

  5. Michael
    Forum Moderator
    Posted 3 years ago #

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

  6. brandcaul
    Posted 3 years ago #

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

  7. brandcaul
    Posted 3 years 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 {
    	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 {
    .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


No tags yet.