New Landing How can we help? Atelier Question regarding social sharing in posts

Viewing 15 posts - 1 through 15 (of 24 total)
  • Posted in: Atelier
  • #181608
    NiO
    Member
    Post count: 233

    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,
    Johan

    #181942
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    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

    #181983
    NiO
    Member
    Post count: 233

    Many thanks!

    #182145
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    No problem. Glad I could help.
    -Rui

    #195252
    NiO
    Member
    Post count: 233

    An 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?

    #195304
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    They are stored in the database

    – Kyle

    #203878
    NiO
    Member
    Post count: 233

    Hi 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!
    Johan

    #203964
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    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

    #204227
    NiO
    Member
    Post count: 233

    Hi Rui & Kyle,

    Tried coping over the code to functions.php, but it doesn’t seem to be used. Is the code still valid?

    Thanks,
    Johan

    #204502
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    1- Have you activated child theme?

    2- Have you made any changes here in the code that is given by Rui?

    Thanks
    Mohammad

    #204703
    NiO
    Member
    Post count: 233

    Hi 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" ) { to if ( sf_current_theme() == "atelier-child" ) {

    Thanks,
    johan

    #205066
    David Martin – Support
    Moderator
    Post count: 20834

    Hi 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.

    #205070
    NiO
    Member
    Post count: 233

    Hi 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,
    Johan

    #205334
    David Martin – Support
    Moderator
    Post count: 20834

    Hi Johan,

    I meant if you send the zip file of your child theme we can inspect it and advise you further ๐Ÿ™‚

    – David.

    #205930
    NiO
    Member
    Post count: 233

    Hi 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

Viewing 15 posts - 1 through 15 (of 24 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register