Support » Plugin: LH Web Share » Works fine!

  • Many thanks for this plugin, I use it for adding a share-button below the content of single posts by adding the following hook to the functions.php of my child theme:

    function lhws_add_to_content( $content ) {
    
        if( is_single() && ! empty( $GLOBALS['post'] ) ) {
    
            if ( $GLOBALS['post']->ID == get_the_ID() ) {
    
                $content .= '<div class="sharing"><a href="#" class="lh_web_share" rel="nofollow">Share</a></div>';
    
            }
    
        }
    
        return $content;
    }
    add_filter('the_content', 'lhws_add_to_content');
    

    The plugin forwards to facebook sharing by default if the browser doesn’t support the Web Sharing API yet.

  • The topic ‘Works fine!’ is closed to new replies.