Skip Navigation

[Resolved] Third-party Shortcode not working in Layout

This support ticket is created 6 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by Richard Healey 6 years ago.

Assisted by: Nigel.

Author
Posts
#1197624
Clipboard02.jpg
Clipboard01.jpg

I am trying to:
Add a new commercial plugin (hidden link) to display IMDb information on the movie / films section of my website. The usage should be simple: [imdb]URL[/imdb]

When I type this format directly into a page, it works fine.

Link to a page where the issue can be seen:
hidden link - shortcode typed directly into content.

I have registered the shortcode.
The field 'website' is a URL. I have it higher on the page as a link to the imdb website.

Any page where the shortcode is displayed from the View is blank.

Any suggestions?

#1197741

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Richard

Shortcodes within shortcodes won't work unless you have special handling for it.

The imdb shortcode would need to pass the content of the shortcode (which is a types shortcode) through the_content filters so that the types shortcode was parsed already and what the imdb shortcode then processed was a url string, not some text which you and I recognise as a types shortcode but which is meaningless to it.

You can work around this by registering your own custom shortcode which you use much like your are currently trying to use the imdb shortcode, where you "do" the types shortcode, then "do" the imdb shortcode with that value, and return the result.

Something like this:

add_shortcode( 'imdbalt', function( $atts = [], $content = null ){

	$url = do_shortcode( $content );

	$imdb = do_shortcode( "[imdb]" . $url . "[/imdb]" );

	return $imdb;
});

In your Layout template, replace the imdb shortcode with the custom imdbalt shortcode.

I haven't tested this but I think it is the kind of thing you will need to do.

#1198065

My issue is resolved now. Thank you!