Topic-icon K2 add social sharing buttons wherever you want..

Active Subscriptions:

None
11 years 6 months ago #49029 by douagg
I'm building a catalogue for my products inside K2 component and I had a problem with the position of social buttons.
By default buttons added after the full K2 text in my article (bottom is selected in my conifg of JFBC). That was a problem for me, cause I'm using modules anywhere to show related items in my MVC template for each category.
The correct position for me is before the item navigation of K2.
Searcing for that I didn't find a suitable solution, show I'm posting here what I've done for anyone who is interested to..

Inside my MVC template of K2 (item.php) I've placed this code:
<div class="social_custom">{JLinkedShare counter=top}</div>
<div class="social_custom">{SCTwitterShare href=<?php echo JURI::base(); ?> data_count=vertical size=medium}</div>
<div class="social_custom">{SCGooglePlusOne size=tall}</div>
<div class="social_custom scpin">{SCPinterestShare href=<?php echo JURI::base(); ?> image=<?php echo $this->item->image; ?> pin_count=above}</div>
<div class="social_custom">{JFBCLike layout=box_count}</div>
The CSS for that is:
.social_custom {
    float: left;
    margin-right: 10px;
}

.scpin { 
	margin-top:38px;
}

It's easy enough and I've accomplish that using JFBC easy tags document that I've found herehere

Hope that helps!
Angelos
The topic has been locked.
Support Specialist
11 years 6 months ago #49032 by mel
Thanks for the explanation.

One thing I wanted to note is that I recommend you do your override of the item.php in a template override, so your changes won't get lost on upgrade of K2.

Also, if you're interested you can place the following div around the Easy-Tags, so that you won't have to do too much of your own styling:
<div style="position: relative; top:0px; left:0px; z-index: 99;" class="scsocialbuttons box_count">...</div>

I've added your (modified) examples to our Common Support Questions www.sourcecoast.com/jfbconnect/docs/common-support-questions/

-Melissa
The topic has been locked.
Active Subscriptions:

None
11 years 5 months ago #49916 by douagg
Thank you Melissa! (So happy that you did that :D :D)

I've added your (modified) examples to our Common Support Questions


In general it is the best practice to work with MVC, in order to avoid "accidents" during an update of any component, module (that support MVC ofcourse).

I am using that code in an override.

Regards
The topic has been locked.
Support Specialist
11 years 5 months ago #49918 by mel
Glad to hear like everything is working for you.

Happy Holidays!
-Melissa
The topic has been locked.