Skip to content

Instantly share code, notes, and snippets.

View anandkumar's full-sized avatar

Anand Kumar anandkumar

View GitHub Profile
@anandkumar
anandkumar / GTM on Genesis Framework
Created October 10, 2012 05:33
Google Tag Manager on Genesis
/**
* Add Add Google Tag Manager script on Genesis Framework
*
* @author Anand Kumar
* @link http://www.blogsynthesis.com/add-google-tag-manager-to-wordpress/#genesis-framework
*
*/
add_action('genesis_before', 'google_tag_manager');
function google_tag_manager() { ?>
@anandkumar
anandkumar / gist:3863360
Created October 10, 2012 05:37
GoogleTag Manager on Thesis Theme
/**
* Add Add Google Tag Manager script on Thesis Theme Framework
*
* @author Anand Kumar
* @link http://www.blogsynthesis.com/add-google-tag-manager-to-wordpress/#thesis-theme-framework
*
*/
function limit_front_page() {
global $query_string;
@anandkumar
anandkumar / gist:4125748
Created November 21, 2012 16:14
Facebook comments on Genesis Framework based theme
/*** Facebook Comment for Single Posts ***/
add_action('genesis_before_comments', 'facebook_comments');
/*** More info at www.blogsynthesis.com/?p=892 ***/
function facebook_comments() {
if (is_single()) { ?>
<div class="fb-comments" data-href="<?php the_permalink(); ?>" data-num-posts="5" data-width="600"></div>
<?php }
}
<script type="text/javascript">
google_ad_client = "ca-publisher-id",
if (window. innerWidth> = 800) {
google_ad_slot = " ad-unit-1 ";
google_ad_width = 728;
google_ad_height = 90;
} Else if (window.innerWidth <400) {
google_ad_slot = " ad-unit-2 ";
google_ad_width = 300;
google_ad_height = 250;
@anandkumar
anandkumar / Facebook Javascript SDK
Created April 7, 2013 23:00
Change the "appId"
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=483949534986562";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
@anandkumar
anandkumar / gist:5371036
Created April 12, 2013 10:15
Genesis Partial width Logo for WordPress
/* Image Header - Partial Width
------------------------------------------------------------ */
.header-image #title-area,
.header-image #title,
.header-image #title a {
display: block;
float: left;
height: 90px;
overflow: hidden;
@anandkumar
anandkumar / functions.php
Last active December 16, 2015 11:38
Add Google+ comments on Genesis Framework / WordPress (or any website)
/*** Google+ Comment for Genesis Framework ***/
add_action('genesis_before_comments', 'google_plus_comments');
/*** More info at http://www.blogsynthesis.com/?p=1072 ***/
function google_plus_comments() {
if (is_single()) { ?>
<div id="google-plus-comments">
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<div id="plusonecomments" style="width: 600px;height: 300px;"></div>
<script type="text/javascript">
window.setTimeout(function() {
@anandkumar
anandkumar / comments.php
Created April 21, 2013 05:50
Add Google+ comments to WordPress by modifying theme file.
/***
* Google+ comments on WordPress
* More info: http://www.blogsynthesis.com/?p=1072
***/
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<div id="plusonecomments"></div>
<script type="text/javascript">
window.setTimeout(function() {
var id = 'plusonecomments';
var divWidth = document.getElementById(id).offsetWidth;
@anandkumar
anandkumar / functions.php
Last active December 16, 2015 12:19
Add Sticky Sharebar to Genesis Framework (Tutorial link: http://www.blogsynthesis.com/?p=1090)
/*
* Add Sharebar Box on Single Posts - Genesis
* Tutorial link: http://www.blogsynthesis.com/?p=1090
* @author Anand Kumar
*/
// Enqueue sticky sharebar script
add_action( 'wp_enqueue_scripts', 'blogsynthesis_sb_enqueue_script' );
function blogsynthesis_sb_enqueue_script() {
wp_enqueue_script( 'sticky-menu', get_stylesheet_directory_uri() . '/js/sticky-sharebar.js', array( 'jquery' ), '', true );
/** Add rel="next" and rel="prev" to Genesis Framework **/
function custom_post_navigation()
{
?>
<div class="prev-next">
<div class="nav-prev">
<?php previous_post_link('%link', '%title'); ?>
</div>
<div class="nav-next">
<?php next_post_link('%link', '%title'); ?>