Last active
September 10, 2015 09:51
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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