[PLUGIN] Shortcode API

User avatar
Fred
Legend Bludit
Posts: 285
Joined: Wed Jun 24, 2015 12:14 pm
Contact:

Sun Aug 28, 2016 8:05 am

peepntom wrote:is there a code to add these to the tinymce thing? just like adding a image or link. i hit the button and add the youtube id instead of looking for the short code over and over.
Look in TinyMCE documentation ;)
╰☆╮Bludit╰☆╮ is a open source and community contributions are essential to project success!
You are looking for a light forum based Json? Try my project Flatboard, it is free. ;)
Sorry for my little english, i'm french :oops:
User avatar
TomboFry
Jr. Bludit
Posts: 2
Joined: Sat Sep 03, 2016 11:31 am

Sat Sep 03, 2016 11:38 am

Here's a YouTube Playlist shortcode. This plugin comes with the shortcode to display a single video, however I modified it slightly to also allow for playlists too:

Code: Select all

// Add Shortcode {YTplaylist width='560' height='315' src='PLUOiYFqn8BWaJLSeProiUaAEeUupMpD3E'}
Shortcode::add('YTplaylist', function($attributes) {
	// Extract attributes
	extract($attributes);
	// src
	if (!isset($width)) $width = '560';
	if (!isset($height)) $height = '315';
	if (!isset($src)) $src = '';
	// return
	return '<iframe width="'.$width.'" height="'.$height.'" src="//www.youtube.com/embed/videoseries?list='.$src.'" frameborder="0" allowfullscreen></iframe>';
});
I make chiptune music: https://tombofry.co.uk/
User avatar
LRAM
Ssr. Bludit
Posts: 13
Joined: Sat Sep 24, 2016 2:02 pm
Location: France
Contact:

Wed Sep 28, 2016 1:44 pm

Here's 3 Soundcloud shortcode. Big, small and Playlist
Image

Code: Select all

// Add Shortcode {SoundCloudBig width='100%' height='315' src='271028176'}
	Shortcode::add('Soundcloudbig', function($attributes) {
	    // Extract attributes
	    extract($attributes);
	    // src
	    if (isset($width)) $width = $width; else $width = '100%';
	    if (isset($height)) $height = $height; else $height = '450';
	    if (isset($src)) $src = $src; else $src = '';
	    // return
	    return '<iframe width="'.$width.'" height="'.$height.'" scrolling="no" frameborder="no" src="//w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/'.$src.'&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true" ></iframe>';
	});
	
	// Add Shortcode {SoundCloudsmall width='100%' height='315' src='271028176'}
	Shortcode::add('Soundcloudsmall', function($attributes) {
	    // Extract attributes
	    extract($attributes);
	    // src
	    if (isset($width)) $width = $width; else $width = '100%';
	    if (isset($height)) $height = $height; else $height = '166';
	    if (isset($src)) $src = $src; else $src = '';
	    // return
	    return '<iframe width="'.$width.'" height="'.$height.'" scrolling="no" frameborder="no" src="//w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/'.$src.'&color=ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false" ></iframe>';
	});
	
		// Add Shortcode {SoundCloudplaylist width='100%' height='450' src='233684197'}
	Shortcode::add('Soundcloudplaylist', function($attributes) {
	    // Extract attributes
	    extract($attributes);
	    // src
	    if (isset($width)) $width = $width; else $width = '100%';
	    if (isset($height)) $height = $height; else $height = '500';
	    if (isset($src)) $src = $src; else $src = '';
	    // return
	    return '<iframe width="'.$width.'" height="'.$height.'" scrolling="no" frameborder="no" src="//w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/'.$src.'&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true" ></iframe>';
	});
the syntax would be

{Soundcloudbig src='271028176'} replace 271028176 with the code of the track

{Soundcloudsmall src='271028176'} replace 271028176 with the code of the track

{Soundcloudplaylist src='233684197'} replace 271028176 with the code of the playlist

Not replacing it will play my songs , it's ok for me :P
https://lucy-racquel-and-me.com
Candies for the ears
User avatar
Herk
Sr. Bludit
Posts: 42
Joined: Wed Aug 19, 2015 6:31 am

Sun Oct 02, 2016 11:46 am

How to use this if I have few pictures?
With names 1, 2, 3
{gallery id='123' size='medium'}
nootkan
Ssr. Bludit
Posts: 16
Joined: Tue Feb 14, 2017 3:59 pm

Sun Apr 23, 2017 12:50 am

Installed this plugin and it is telling me:
This plugin is incompatible with Bludit v1.5.2
.

I tried changing the json file to:

Code: Select all

"compatible": "1.4,1.5,1.5.2beta",
but that didn't change anything.
User avatar
Edi
Site Admin
Posts: 988
Joined: Sun Aug 09, 2015 3:01 pm
Location: Zurich
Contact:

Sun Apr 23, 2017 12:54 pm

You have to change it to the following:

Code: Select all

"compatible": "1.4,1.5,1.5.2",
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
nootkan
Ssr. Bludit
Posts: 16
Joined: Tue Feb 14, 2017 3:59 pm

Mon Apr 24, 2017 12:39 am

Okay thanks. It is still okay to use right?
User avatar
Edi
Site Admin
Posts: 988
Joined: Sun Aug 09, 2015 3:01 pm
Location: Zurich
Contact:

Mon Apr 24, 2017 9:29 am

If it works... The message is only a warning "This plugin is not tested with Bludit ...".
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
User avatar
AlexanderLiebrecht
Jr. Bludit
Posts: 4
Joined: Wed Nov 22, 2017 9:14 pm

Wed Nov 22, 2017 9:20 pm

Hi @Fred ,

We know each other from your support flatboard forum and I did not think that you also develop plugins. That suits me very much, because I wanted to ask you after the upgrade for the shortcode Api for Bludit 2.0.2.

Would that be feasible or are you not doing any more in that sense?

Thanks in advance and best regards from Rostock.
Blogger, Webmaster, Linux/CMS-Admin, Wiki-Writer, CMS-Installateur und CMS-Fan from Rostock, Germany. Main-Blog: https://internetblogger.de and Bludit-Page under http://bludit.wpzweinull.ch
Post Reply