Last active
June 30, 2019 14:10
-
-
Save sebadima/af0b144e109be6721a29837f37dda86b to your computer and use it in GitHub Desktop.
This file contains 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: Social Buttons | |
* Plugin URI: https://www.sebadima.com | |
* Description: A simple plugin to share a post on socials networks. | |
* Version: 1.3a | |
* Author: Sebastiano Dimartina | |
* Author URI: https://www.sebadima.com | |
*/ | |
add_action( 'the_content', 'dsse_sharing' ); | |
add_action( 'wp_enqueue_scripts', 'dsse_load_plugin_css' ); | |
function dsse_load_plugin_css() { | |
$plugin_url = plugin_dir_url( __FILE__ ); | |
wp_enqueue_style( 'style', $plugin_url . 'css/style.css' ); | |
} | |
function dsse_sharing ( $content ) { | |
$html = "Condividi se ti è piaciuto"; | |
$html = $html . "<br>"; | |
global $post; | |
$url = get_permalink($post->ID); | |
$url = esc_url($url); | |
$html = $html . "<div class='facebook'><a target='_blank' href='http://www.facebook.com/sharer.php?u=" . $url . "'>💙 </a></div>"; | |
$html = $html . "<a> </a>"; | |
$html = $html . "<div class='twitter'><a target='_blank' href='https://twitter.com/share?url=" . $url . "'>💙</a></div>"; | |
$html = $html . "<br>"; | |
$html = $html . "<br>"; | |
return $content = $content . $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment