WordPress.org

Ready to get started?Download WordPress

Forums

Crafty Social Buttons
[resolved] share buttons not formatted correctly (5 posts)

  1. designwrench
    Member
    Posted 9 months ago #

    My link buttons work fine, but the share buttons are losing some HTML formatting somehow, and spitting code out instead of images:
    http://www.davinapallone.com/about-the-artist/

    I love the simplicity of this plugin. Help?

    http://wordpress.org/plugins/crafty-social-buttons/

  2. designwrench
    Member
    Posted 9 months ago #

    For instance, this is the code that is generated, which is, of course, very odd and broken:

    <li>
        <a class="crafty-social-button csb-stumbleupon" <br="">
            href=”http://www.stumbleupon.com/submit?url=h…
            <img<br>
                title=”StumbleUpon”
                <br></br>
                alt=”StumbleUpon”
                <br></br>
    	    src=”http://www.davinapallone.com/wp-content…
                <span class="crafty-social-share-count"> … </span>
            </img<br>
        </a>
    </li>
  3. designwrench
    Member
    Posted 9 months ago #

    This is the code that shows on my posts instead of icons. I'm pasting it here because I want to remove the error from my live site.

    href=”http://www.facebook.com/sharer.php?u=http://www.davinapallone.com/” target=”_blank”> title=”Facebook”
    alt=”Facebook”
    src=”http://www.davinapallone.com/wp-content/plugins/crafty-social-buttons/buttons/somacro/facebook.png” />
  4. karizmuh
    Member
    Posted 8 months ago #

    Hello, I've encounter the same issue as designwrech, though it didn't show up for myself until after I turned on the filter for wpautop. Anyway, I've tracked it down to all files in the services directory.

    Basically, the shareButton, linkButton, and buttonImage have hard returns in the html, and when parsed, they show up as br tags where the hard returns are.

    Here's an illustration for anyone interested. I'm going to use the offending code from file class-SH_Digg.php, it's the same for all files though with the exception of class-SH_Social_Service.php

    (shareButton for Digg):

    $html = '<a class="' . $this->cssClass() . '"
    			href="http://www.digg.com/submit?'
    			. 'url='. $url. '" '
    			. ($this->newWindow ? 'target="_blank"' : '') . '>';

    Should look like this instead.

    $html = '<a class="' . $this->cssClass() . '" href="http://www.digg.com/submit?' . 'url='. $url. '" ' . ($this->newWindow ? 'target="_blank"' : '') . '>';
    $html .= $this->buttonImage();
    $html .= '</a>';

    (linkButton for Digg):

    $html = '<a class="' . $this->cssClass() . '"
    			href="'. $url. '" ' .
    			($this->newWindow ? 'target="_blank"' : '') . '>';

    Should look like this instead.

    $url = "http://www.digg.com/$username";
    $html = '<a class="' . $this->cssClass() . '" href="'. $url. '" ' . ($this->newWindow ? 'target="_blank"' : '') . '>';
    $html .= $this->buttonImage();
    $html .= '</a>';

    And finally, in file class-SH_Social_Service.php - funny name for the file =)

    buttonImage:

    $imageUrl = $this->imagePath . trim(strtolower($this->service)) . $this->imageExtension;
    		return '<img
    				   title="'.$this->service.'"
    					alt="'.$this->service. '"
    					src="' . $imageUrl .'" />';

    Should look like this:

    $imageUrl = $this->imagePath . trim(strtolower($this->service)) . $this->imageExtension;
    return '<img title="'.$this->service.'" alt="'.$this->service. '" src="' . $imageUrl .'" />';

    Anyway, that's pretty much it. Hope it helps for those who need a quick fix until one can be made from the author.

    Thanks for the plugin, keep up the good work!

  5. shen045
    Member
    Plugin Author

    Posted 8 months ago #

    Thanks for debugging this - I have removed all the extra spacing in the files in the next release (1.0.7) so this problem shouldn't happen again. Please let me know if it does.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.