Digital experiences for all disciplines
New Landing › How can we help? › Atelier › Question regarding social sharing in posts
New Landing › How can we help? › Atelier › Question regarding social sharing in posts
- This topic has 23 replies, 7 voices, and was last updated 9 years by Rui Guerreiro – SUPPORT.
-
Posted in: Atelier
-
June 4, 2015 at 8:00 pm #181608
Hi Swiftideas,
I have enabled the sharing option for posts and see three options there: Facebook, Twitter and Pinterest. How do I control these sharing options? Is there a theme options panel for it? Can’t seem to find it ๐
I would like to include more sharing options. ow can I do that or do I need to install a plugin like sharethis for it?
Thanks,
JohanJune 5, 2015 at 11:51 pm #181942Hi,
It’s only those 3 by default but you can add more modifying the social function.
Add this to the functions.php of your child theme and add your social links below the existing ones.
/* SOCIAL SHARE SHORTCODE ================================================= */ if ( !function_exists( 'sf_social_share' ) ) { function sf_social_share( $atts = null ) { extract( shortcode_atts( array( "center" => '', ), $atts ) ); if ( sf_current_theme() == "atelier" ) { global $post; $image = wp_get_attachment_url( get_post_thumbnail_id() ); $page_permalink = urlencode(get_the_permalink()); $page_title = get_the_title(); $page_thumb_id = get_post_thumbnail_id(); $page_thumb_url = wp_get_attachment_url( $page_thumb_id ); $share_output = ""; if ( $center == "yes" ) { $share_output .= '<div class="sf-share-counts center-share-counts">'; } else { $share_output .= '<div class="sf-share-counts">'; $share_output .= '<h3 class="share-text">'.__("Share", 'swift-framework-plugin').'</h3>'; $share_output .= '<a href="https://www.facebook.com/sharer/sharer.php?u='.$page_permalink.'&height=640&width=660&resizable=0&toolbar=0&menubar=0&status=0&location=0&scrollbars=0" class="sf-share-link sf-share-fb"><i class="fa-facebook"></i><span class="count">0</span></a>'; $share_output .= '<a href="http://twitter.com/share?text='.$page_title.'&url='.$page_permalink.'&height=640&width=660&resizable=0&toolbar=0&menubar=0&status=0&location=0&scrollbars=0" class="sf-share-link sf-share-twit"><i class="fa-twitter"></i><span class="count">0</span></a>'; $share_output .= '<a href="http://pinterest.com/pin/create/button/?url='.$page_permalink.'&media='.$page_thumb_url.'&description='.$page_title.'&height=640&width=660&resizable=0&toolbar=0&menubar=0&status=0&location=0&scrollbars=0" class="sf-share-link sf-share-pin"><i class="fa-pinterest"></i><span class="count">0</span></a>'; $share_output .= '</div>'; } return $share_output; } else { global $post; $image = wp_get_attachment_url( get_post_thumbnail_id() ); if ( $center == "yes" ) { $share_output = '<div class="article-share share-center" data-buttontext="' . __( "Share this", 'swift-framework-plugin' ) . '" data-image="' . $image . '"></div>'; } else { $share_output = '<div class="article-share" data-buttontext="' . __( "Share this", 'swift-framework-plugin' ) . '" data-image="' . $image . '"></div>'; } return $share_output; } } add_shortcode( 'sf_social_share', 'sf_social_share' ); }
-Rui
June 6, 2015 at 5:34 pm #181983Many thanks!
June 7, 2015 at 11:17 pm #182145No problem. Glad I could help.
-RuiJuly 16, 2015 at 1:42 pm #195252An additional question regarding thus Rui … are the sharing counts registered in the WP database or are they real statistics retrieved from the social media platforms?
July 16, 2015 at 3:20 pm #195304Hi
They are stored in the database
– Kyle
August 13, 2015 at 9:37 pm #203878Hi Rui, Kyle,
Any chance that you already have the extra line of code needed for sharing to Google+ lying around. Or is there a place where I can find more info about it?
Thanks!
JohanAugust 14, 2015 at 8:27 am #203964Hi
I’m afraid I don’t sorry, best thing you can do is check our theme files for the current sharing setup and google to see if you can find the code for google+
– Kyle
August 14, 2015 at 7:45 pm #204227Hi Rui & Kyle,
Tried coping over the code to functions.php, but it doesn’t seem to be used. Is the code still valid?
Thanks,
JohanAugust 17, 2015 at 11:13 am #204502Hi,
1- Have you activated child theme?2- Have you made any changes here in the code that is given by Rui?
Thanks
MohammadAugust 17, 2015 at 7:15 pm #204703Hi Mohammad,
Yes, I use a child theme and copied the code into the functions.php there. To test the code, I tried duplicating one of the $share_output lines to see if an extra icon would pop up. In addition I tried adding this:
$share_output .= 'test';
As a last resort I changed the if statement
if ( sf_current_theme() == "atelier" ) {
toif ( sf_current_theme() == "atelier-child" ) {
Thanks,
johanAugust 18, 2015 at 4:41 pm #205066Hi Johan,
This customisation is really outside the scope of support.
The best we can do for you is to take a closer look at your child theme. Can you please upload the zip file or provide us a link where we can download it and inspect it.
If you need deep customiations and fast, please submit a request here: http://www.swiftideas.com/customization/
– David.
August 18, 2015 at 4:56 pm #205070Hi David,
I will customise it myself, but want to make sure I have the right starting point ๐ I have tried including the function code Rui provided into the functions.php, but it doesn’t seem “to take”. I had no problem so far with other functions …
I didn’t mention a zip file. Just want to overrule the social sharing function via my child theme ๐
Cheers,
JohanAugust 19, 2015 at 1:09 pm #205334Hi Johan,
I meant if you send the zip file of your child theme we can inspect it and advise you further ๐
– David.
August 20, 2015 at 7:02 pm #205930Hi David,
Let’s forget about this now. Even if I get it to work I will need to put quite some effort into customising it. I like the approach a lot, but I simply cannot live without the G+ button as I have a large following on there … but getting it in there in line with the rest will be difficult for me. Maybe you can make this an official change request ๐
I will hunt for a WordPress plugin that does more or less the same.
Cheers,
Johan -
Posted in: Atelier
You must be logged in and have valid license to reply to this topic.