Forum

Support is provided free and on a “best endeavours” basis. This is usually daylight hours, UK time, Monday to Friday.
At the time of this screen being refreshed it was Tuesday 12:21am in the UK.

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
AuthorTopic: Simple Timed Content - Shortcodes
Richard-
Young
Newbie
Posts: 3
Post Simple Timed Content - Shortcodes
on: May 15, 2011, 12:03

Is there any chance of making this plugin work with other shortcode content contained within the [timed]...[/timed] shortcodes?

I have researched other expiring content plugins and the same happens so I wondered if it was a generalised WP thing but after a minor amount of searching I recall seeing a wordress.org post stating that since v2.5 this was achievable.

I would like to thank you for all your great work. Yours is the only expiring content plugin that allows for an ondate which is truly awesome for swapping content and not just expiring it.

Hopefully...

Richard

Richard-
Young
Newbie
Posts: 3
Post Re: Simple Timed Content - Shortcodes
on: May 15, 2011, 19:37

The Solution

Whilst waiting for a reply I decided to locate the wordpress.org post as a reference for David.

http://codex.wordpress.org/Shortcode_API

The Shortcode API

Introduced in WordPress 2.5 is the Shortcode API, a simple set of functions for creating macro codes for use in post content.
.
.
.
Limitations
Nested Shortcodes

The shortcode parser correctly deals with nested shortcode macros, provided their handler functions support it by recursively calling do_shortcode():

By searching a little harder I also appear to have found the solution, thanks to an article by Toby Mackenzie http://tobymackenzie.wordpress.com/2010/02/28/wordpress-shortcodes/.

Since shortcode content isn't process like post/page content, you will have to process it. You can use the "do_shortcode" function to ensure nested shortcodes are handled.

Changing the Plugin Code

Line 17 of Version: 1.1.1, is the function Return...

return "<!-- Simple Timed Content v".simple_timed_content_version." | http://www.artiss.co.uk/simple-timed-content -->\n".$content."<!-- End of Simple Timed Content -->\n";

This just needs changing to process any other registered shortcodes contained within...

return "<!-- Simple Timed Content v".simple_timed_content_version." | http://www.artiss.co.uk/simple-timed-content -->\n".do_shortcode($content)."<!-- End of Simple Timed Content -->\n";

I hope this helps!

Richard

David-
Artiss
Administrator
Posts: 382
Post Re: Simple Timed Content - Shortcodes
on: May 16, 2011, 11:12

Hi Richard,

Thanks for all that - yes, I came across this capability a couple of weeks ago. It's my intention to add this to the next release - in the meantime you can continue with the modified version that you detailed above.

David.

Richard-
Young
Newbie
Posts: 3
Post Re: Simple Timed Content - Shortcodes
on: May 17, 2011, 16:01

Excellent! I look forward to the official update so that all users of the plugin can save themselves the time and effort.

Richard

chris
Newbie
Posts: 1
Post Re: Simple Timed Content - Shortcodes
on: November 12, 2011, 12:46

Ah... Awesome you rock. I was able to use a nested custom field look-up to specify a video playlist to play using Youtube Embed.

like this

[youtube][custom_field field="cf_video_1_code" this_post="1" limit="0" between=", " /][/youtube]

by Editing youtube-embed/includes/shortcodes.php:

Find:

function ye_video_shortcode_default( $paras = '', $content = '' ) {
 return ye_video_shortcode( $paras, $content );

replace $content with;
do_shortcode($content)
so it looks like this;

function ye_video_shortcode_default( $paras = '', $content = '' ) {
 return ye_video_shortcode( $paras, do_shortcode($content) );

thanks, you rock.

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.33.2 ; Page loaded in: 0.021 seconds.