• Resolved JackGraal

    (@jackgraal)


    Hi,

    How can I add the SHARE button to my social buttons bar?

    Right now it displays only FB Like button. It functions as a Share button, but doesn’t allow you to share directly to a Facebook Page or Group. I’d like to add the official FB Share button under the Like Buttton.

    Example post with social buttons – https://jackgraal.com/pl/gry-filmy-seriale-jak-to-wszystko-ogarnac/

    My share.php file looks like this:

    <div class="sharrre-container">
    	<div id="facebook" data-url="<?php echo the_permalink(); ?>" data-text="<?php echo the_title(); ?>" data-title="Like"></div>
    	<div id="twitter" data-url="<?php echo the_permalink(); ?>" data-text="<?php echo the_title(); ?>" data-title="Tweet"></div>
    	<div id="googleplus" data-url="<?php echo the_permalink(); ?>" data-text="<?php echo the_title(); ?>" data-title="+1"></div>
    			<?php endif; ?></div>
    
    </div><!--/.sharrre-container-->
    
    <script type="text/javascript">
    	// Sharrre
    	jQuery(document).ready(function(){
    
    	jQuery('#facebook').sharrre({
    			share: {
    				facebook: true
    					},
    		shorterTotal: true,
    		enableHover: true,
    		enableCounter: false,
    		enableTracking: true,
    		buttons: {
       	 facebook: {layout: 'box_count'},
        	}
    
    		});
    
    	jQuery('#twitter').sharrre({
    			share: {
    				twitter: true
    					},
    		shorterTotal: true,
                enableHover: false,
                enableCounter: false,
                enableTracking: true,
    		buttons: {
      	  twitter: {count: 'vertical', via: 'JackGraal'}
    	}
    
    		});
    
    	jQuery('#googleplus').sharrre({
    			share: {
    				googlePlus: true
    				},
    		shorterTotal: true,
                enableHover: false,
                enableCounter: false,
                enableTracking: true,
    		buttons: {
        googlePlus: {size: 'tall', annotation:'bubble'}
    	}
    		});
    
    		<?php if ( ot_get_option( 'sharrre-scrollable' ) == 'on' ): ?>
    			// Scrollable sharrre bar, contributed by Erik Frye. Awesome!
    			var shareContainer = jQuery(".sharrre-container"),
    			header = jQuery('#header'),
    			postEntry = jQuery('.entry'),
    			$window = jQuery(window),
    			distanceFromTop = 20,
    			startSharePosition = shareContainer.offset(),
    			contentBottom = postEntry.offset().top + postEntry.outerHeight(),
    			topOfTemplate = header.offset().top;
    			getTopSpacing();
    
    			shareScroll = function(){
    				if($window.width() > 719){
    					var scrollTop = $window.scrollTop() + topOfTemplate,
    					stopLocation = contentBottom - (shareContainer.outerHeight() + topSpacing);
    					if(scrollTop > stopLocation){
    						shareContainer.offset({top: contentBottom - shareContainer.outerHeight(),left: startSharePosition.left});
    					}
    					else if(scrollTop >= postEntry.offset().top-topSpacing){
    						shareContainer.offset({top: scrollTop + topSpacing, left: startSharePosition.left});
    					}else if(scrollTop < startSharePosition.top+(topSpacing-1)){
    						shareContainer.offset({top: startSharePosition.top,left:startSharePosition.left});
    					}
    				}
    			},
    
    			shareMove = function(){
    				startSharePosition = shareContainer.offset();
    				contentBottom = postEntry.offset().top + postEntry.outerHeight();
    				topOfTemplate = header.offset().top;
    				getTopSpacing();
    			};
    
    			/* As new images load the page content body gets longer. The bottom of the content area needs to be adjusted in case images are still loading. */
    			setTimeout(function() {
    				contentBottom = postEntry.offset().top + postEntry.outerHeight();
    			}, 2000);
    
    			if (window.addEventListener) {
    				window.addEventListener('scroll', shareScroll, false);
    				window.addEventListener('resize', shareMove, false);
    			} else if (window.attachEvent) {
    				window.attachEvent('onscroll', shareScroll);
    				window.attachEvent('onresize', shareMove);
    			}
    
    			function getTopSpacing(){
    				if($window.width() > 1024)
    					topSpacing = distanceFromTop + jQuery('.nav-wrap').outerHeight();
    				else
    					topSpacing = distanceFromTop;
    			}
    		<?php endif; ?>
    
    	});
    </script>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add official FB Share to social buttons bar’ is closed to new replies.