Skip to content

Instantly share code, notes, and snippets.

Created April 19, 2022 16:01
What would you like to do?
YOURLS Share on Tumblr

Plugin: Share on Tumblr

In the Quick Share box, add a one-click share to Tumblr link.


  • In /user/plugins, create a new folder named quickshare-on-tumblr
  • In this new directory, create a blank file named plugin.php
  • In this new file, cut and paste the following code
  • Go to the Plugins administration page and activate the plugin


Plugin Name: Share on Tumbler
Plugin URI:
Description: Add <a href="">Tumblr</a> to the list of Quick Share destinations
Version: 1.0
Author: Ozh
Author URI:

yourls_add_action( 'share_links', 'ozh_yourls_tumblr' );

function ozh_yourls_tumblr( $args ) {
	list( $longurl, $shorturl, $title, $text ) = $args;
	$shorturl = rawurlencode( $shorturl );
	$title = rawurlencode( htmlspecialchars_decode( $title ) );
	echo <<<TUMBLR
	<style type="text/css">
	#share_tb{background:transparent url( left center no-repeat;}
	<a id="share_tb"
		title="Share on Tumblr"
		onclick="yourls_share_on_tumblr();return false;">Tumblr
	<script type="text/javascript">
	// Send to Tumblr open window
	function yourls_share_on_tumblr() {
		var url = $('#share_tb').attr('href');, 'tb', 'toolbar=no,width=800,height=550');
		return false;
	// Dynamically update Tumblr link
	// when user clicks on the "Share" Action icon, event $('#tweet_body').keypress() is fired, so we'll add to this
		var title = encodeURIComponent( $('#titlelink').val() );
		var url = encodeURIComponent( $('#copylink').val() );
		var tb = ''+url+'&t='+title;
		$('#share_tb').attr('href', tb);		

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment