Skip to content

Instantly share code, notes, and snippets.

@graylaurenm
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graylaurenm/422f0340d2a5c356e0c0 to your computer and use it in GitHub Desktop.
Save graylaurenm/422f0340d2a5c356e0c0 to your computer and use it in GitHub Desktop.
<?php
//* Enqueue child theme JavaScript.
add_action( 'wp_enqueue_scripts', 'lgd_enqueue_js' );
//* Load additional javascript.
function lgd_enqueue_js() {
wp_enqueue_script( 'social-by-post', get_stylesheet_directory_uri().'/js/social-by-post.js' , '', '', true );
}
?>
<?php
//* Add Po.st sharing under post title, on single pages
add_filter( 'genesis_entry_content', 'lgd_post_sharing', 4 );
function lgd_post_sharing() {
if ( is_single() )
echo '<div class="pw-widget"></div>';
}
?>
// asynchronous load
var pwidget_config = {
publisherKey: "your-key-goes-here",
// mobile optimization
mobileOverlay: true,
retine: true,
// 'share' overlay when copying selection
shareQuote: true,
// multi language support
locale: "auto",
// global settings
defaults: {
// turn after-the-share ad off
afterShare: false,
// visuals
vertical: true,
size: 'medium',
buttons: [
{ id: 'facebook', counter: 'show' },
{ id: 'twitter', counter: 'show'},
{ id: 'googleplus', counter: 'show'},
{ id: 'pinterest', counter: 'show'},
{ id: 'email', counter: 'show'},
{ id: 'post'}
],
counter: 'horizontal',
// mention my handle on twitter
services: {twitter: {via: "your-twitter-handle-goes-here"}},
// use pop ups rather than new tab for major services
sharePopups: true
}
};
(function () {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'http://i.po.st/share/script/post-widget.js';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
})();
/* Po.st Social Sharing
------------------------- */
.sidebar .widget .pw-widget,
.entry .entry-content .pw-widget {
width: 100% !important;
}
.entry .entry-content .pw-widget {
margin: 20px 0;
margin: 2rem 0;
}
.sidebar .widget .pw-widget .pw-button,
.entry-content .pw-widget .pw-button {
color: #FFF;
background: #222 !important;
margin: 0 0 5px !important;
margin: 0 0 .5rem !important;
width: 100%;
}
.entry .entry-content .pw-widget .pw-button {
display: inline-block !important;
margin: 0 1.8% 0 0 !important;
width: 15%;
}
.entry .entry-content .pw-widget .pw-button:last-child {
margin-right: 0 !important;
}
.sidebar .widget .pw-widget .pw-button-facebook,
.entry-content .pw-widget .pw-button-facebook {
background-color: #3b5998 !important;
}
.sidebar .widget .pw-widget .pw-button-twitter,
.entry-content .pw-widget .pw-button-twitter {
background-color: #55acee !important;
}
.sidebar .widget .pw-widget .pw-button-googleplus,
.entry-content .pw-widget .pw-button-googleplus {
background-color: #dd4b39 !important;
}
.sidebar .widget .pw-widget .pw-button-pinterest,
.entry-content .pw-widget .pw-button-pinterest {
background-color: #cb2027 !important;
}
.sidebar .widget .pw-widget .pw-button-email,
.entry-content .pw-widget .pw-button-email {
background-color: #e04c40 !important;
}
.sidebar .widget .pw-widget .pw-button:hover,
.entry-content .pw-widget .pw-button:hover {
background: #AAA !important;
}
.sidebar .widget .pw-widget .pw-icon:before,
.entry-content .pw-widget .pw-icon:before {
display: block;
text-align: center;
font: 25px/40px 'FontAwesome' !important;
font: 2.5rem/4rem 'FontAwesome' !important;
height: 40px;
width: 100%;
}
.entry-content .pw-widget .pw-icon:before {
font: 2px/30px 'FontAwesome' !important;
font: 2rem/3rem 'FontAwesome' !important;
height: 30px;
height: 3rem;
}
.sidebar .widget .pw-widget .pw-button-facebook .pw-icon:before,
.entry-content .pw-widget .pw-button-facebook .pw-icon:before {
content: "\f09a";
}
.sidebar .widget .pw-widget .pw-button-twitter .pw-icon:before,
.entry-content .pw-widget .pw-button-twitter .pw-icon:before {
content: "\f099";
}
.sidebar .widget .pw-widget .pw-button-googleplus .pw-icon:before,
.entry-content .pw-widget .pw-button-googleplus .pw-icon:before {
content: "\f0d5";
}
.sidebar .widget .pw-widget .pw-button-pinterest .pw-icon:before,
.entry-content .pw-widget .pw-button-pinterest .pw-icon:before {
content: "\f0d2";
}
.sidebar .widget .pw-widget .pw-button-email .pw-icon:before,
.entry-content .pw-widget .pw-button-email .pw-icon:before {
content: "\f0e0";
}
.sidebar .widget .pw-widget .pw-button-post .pw-icon:before,
.entry-content .pw-widget .pw-button-post .pw-icon:before {
content: "\f067";
}
.sidebar .widget .pw-widget .pw-button .pw-icon,
.entry-content .pw-widget .pw-button .pw-icon,
.sidebar .widget .pw-widget .pw-button .pw-button-counter i,
.entry-content .pw-widget .pw-button .pw-button-counter i {
background-image: none;
}
.sidebar .widget .pw-widget .pw-button .pw-icon,
.entry-content .pw-widget .pw-button .pw-icon {
margin: 0;
height: 40px;
width: 50%;
}
.entry-content .pw-widget .pw-button .pw-icon {
height: 30px;
height: 3rem;
}
.sidebar .widget .pw-widget .pw-button .pw-button-counter,
.entry-content .pw-widget .pw-button .pw-button-counter {
height: 40px;
width: 50% !important;
padding: 0 !important;
}
.entry-content .pw-widget .pw-button .pw-button-counter {
height: 30px;
height: 3rem;
}
.sidebar .widget .pw-widget .pw-button .pw-button-counter i,
.entry-content .pw-widget .pw-button .pw-button-counter i {
margin: 0 !important;
width: 0;
}
.sidebar .widget .pw-widget .pw-button .pw-button-counter span,
.entry-content .pw-widget .pw-button .pw-button-counter span {
color: #FFF !important;
font: 20px/40px 'museosans', Arial, Helvetica, sans-serif !important;
font: 2rem/4rem 'museosans', Arial, Helvetica, sans-serif !important;
padding: 0 !important;
border: 0 !important;
width: 100% !important;
background-color: transparent;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.entry-content .pw-widget .pw-button .pw-button-counter span {
font: 15px/30px 'museosans', Arial, Helvetica, sans-serif !important;
font: 1.5rem/3rem 'museosans', Arial, Helvetica, sans-serif !important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment