Skip to content

Instantly share code, notes, and snippets.

@sebadima
Last active March 23, 2022 12:53
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 sebadima/30bfec525eb1d2f4a8c6993cfe013eac to your computer and use it in GitHub Desktop.
Save sebadima/30bfec525eb1d2f4a8c6993cfe013eac to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: Social Buttons
* Plugin URI: https://blog.kaspian.it/come-scrivere-un-semplice-plugin-per-wordpress/
* Description: Un semplice plugin per condividere un post su Twitter e Facebook
* Version: 1.5a
* Author: Sebastiano Dimartina
* Author URI: https://blog.kaspian.it/author/sebadima/
*/
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 . "'>facebok™ </a></div>";
$html = $html . "<a>&nbsp;&nbsp;</a>";
$html = $html . "<div class='twitter'><a target='_blank' href='https://twitter.com/share?url=" . $url . "'>Twitter™</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