Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created September 28, 2013 01:26
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 joshfeck/6737395 to your computer and use it in GitHub Desktop.
Save joshfeck/6737395 to your computer and use it in GitHub Desktop.
A simple plugin that will let you customize the default text that gets placed into a tweet. Works with Event Espresso and its social buttons add-on.
<?php
/*
Plugin Name: Custom Twitter Button for Event Espresso
Plugin URI: http://github.com/
Description: This plugin will override the tweet button in Event Espresso
Version: 1.0
Author: Sarah
License: GPLv2
*/
if (!function_exists('espresso_twitter_button')) {
function espresso_twitter_button($event_id) {
global $espresso_twitter;
//Build the URl to the page
$registration_url = espresso_reg_url($event_id);
// custom default text
$text = 'My custom default text';
// new button
if (is_ssl()) {
$button = '<a href="https://twitter.com/share"';
} else {
$button = '<a href="http://twitter.com/share"';
}
$button .= 'class="twitter-share-button" data-url="' . $registration_url;
$button .= '" data-text="' . $text;
$button .= '" data-count="' . $espresso_twitter['espresso_twitter_count_box'];
$button .= '" data-via="' . $espresso_twitter['espresso_twitter_username'];
$button .= '" data-lang="' . $espresso_twitter['espresso_twitter_lang'];
if (is_ssl()) {
$button .= '">Tweet</a><script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>';
} else {
$button .= '">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>';
}
// all done!
return $button;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment