Recent Topics

1 Jan 05, 2011 23:32    

My b2evolution Version: 3.3.3

Hello Everyone,
I've been trying to add the ShareThis buttons to my blog, and i've finally done it. I wanted to share the process with you and help somebody else that's been having this problem.
1 - Create an account with ShareThis.com.
2 - Follow all their regular steps for creating the buttons.
3 - Once you get the code, copy the javascript code to _html_header.inc.php inside the <head></head> tags
4 - Then you need to copy the button code and add 2 options to the span tags. I've added the st_title and st_url options. You need to add this two tags on the first span tag on EACH and EVERY single button you add.


st_url="<?php $Item->permanent_url( $mode = '', $blogurl='' ); ?>"
st_title="<?php $Item->title( array('link_type'=>'none',)); ?>"


My code looks like this (I selected a horizontal counter and four buttons)


        <span class="st_twitter_hcount" displayText="Tweet" 
                  st_url="<?php $Item->permanent_url( $mode = '', $blogurl='' ); ?>"
                  st_title="<?php $Item->title( array('link_type'=>'none',)); ?>"></span>
        <span class="st_facebook_hcount" displayText="Share" 
                  st_url="<?php $Item->permanent_url( $mode = '', $blogurl='' ); ?>"
                  st_title="<?php $Item->title( array('link_type'=>'none',)); ?>"></span>
        <span class="st_email_hcount" displayText="Email" 
                  st_url="<?php $Item->permanent_url( $mode = '', $blogurl='' ); ?>"
                  st_title="<?php $Item->title( array('link_type'=>'none',)); ?>"></span>
        <span class="st_sharethis_hcount" displayText="Share" 
                  st_url="<?php $Item->permanent_url( $mode = '', $blogurl='' ); ?>"
                  st_title="<?php $Item->title( array('link_type'=>'none',)); ?>"></span>

5 - Add this code to the following page templates:
_item_block.inc.php (will show up on your main blog page on every single post. I've placed it after the Post Content Include)
_single_main.php (will show up on an individual post. I've placed it after the Post Content Include)

I tested it on one of my blogs and it seems to work.[/quote]

2 Jan 06, 2011 00:35

Thanks for sharing the code. You should use the following format though.

st_url="<?php $Item->permanent_url() ?>"
st_title="<?php $Item->disp('title') ?>"

4 Jan 06, 2011 04:15

I had troubles with the code. It didn't show up once i added it to the files

5 Jul 13, 2011 16:19

This is good, the old plugin doesn't really let you display the social sites as separate buttons. Any way we could put this new method in a neat plugin format?

Edit: Out of interest, does this work with v4.x?

Edit x2: Yes it does!


Form is loading...