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

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What’s supposed to happen?

    Thread Starter brandcaul

    (@brandcaul)

    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?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

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

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

    Thread Starter brandcaul

    (@brandcaul)

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

    Thread Starter brandcaul

    (@brandcaul)

    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="https://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.