Skip to content

Instantly share code, notes, and snippets.

@birgire
Last active September 10, 2015 09:51
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 birgire/be3dc8174e227233fa70 to your computer and use it in GitHub Desktop.
Save birgire/be3dc8174e227233fa70 to your computer and use it in GitHub Desktop.
WordPress: Add the Hueman theme's sharing bar to pages. (Fix for those who don't have a recommended child theme)
<?php
/**
* Plugin Name: Hueman Theme - Sharrre Sharing Bar On Pages
* Description: Add the Hueman theme's sharing-bar to pages. (Fix for those who don't have a recommended child theme)
* Plugin URI: https://gist.github.com/birgire/be3dc8174e227233fa70
* Author: Birgir Erlendsson (birgire)
* Author URI: https://github.com/birgire
* Version: 0.0.1
* Licence: MIT
*/
/**
* Append the Sharrre sharing-bar to the page content
*/
add_filter( 'the_content', function( $content )
{
if (
! is_admin()
&& in_the_loop()
&& is_page()
&& function_exists( 'ot_get_option' )
&& ot_get_option('sharrre') != 'off'
) {
ob_start();
get_template_part('inc/sharrre');
$content .= ob_get_clean();
$content .= "<script>jQuery( '.entry.themeform').addClass( 'share' );</script>;";
}
return $content;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment