Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active December 11, 2015 18:59
Show Gist options
  • Save billerickson/eb0e66f1652ebb82b17f to your computer and use it in GitHub Desktop.
Save billerickson/eb0e66f1652ebb82b17f to your computer and use it in GitHub Desktop.
<?php
/**
* Facebook Comments
*
*/
function be_facebook_comments() {
echo '<h2>Submit a Comment</h2>';
echo '<div class="fb-comments" data-href="' . be_production_url( get_permalink() ) . '" data-numposts="5" data-width="100%"></div>';
}
add_action( 'genesis_after_entry', 'be_facebook_comments' );
remove_action( 'genesis_after_entry', 'genesis_get_comments_template' );
/**
* Facebook Comment Moderators
* Use this to find your ID: http://findmyfbid.com/
*/
function be_facebook_comment_moderators() {
echo '<meta property="fb:admins" content="12345678"/>';
}
add_action( 'wp_head', 'be_facebook_comment_moderators' );
/**
* Production URL
* Helper function to always reference live URLs
*/
function be_production_url( $url ) {
$production_url = 'https://clientsite.com';
$dev_urls = array(
'http://localdev/clientsite',
'http://clientsite.staging.wpengine.com',
);
return str_replace( $dev_urls, $production_url, $url );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment