Jump to content

Markup Shortcodes with same shortcode more the once in content


jsantari
 Share

Recommended Posts

Trying out the shortcodes and it works but - I created a shortcode for youtube then put one on a page and it works fine. I then added a second one for another video and the second one works but the first one is now not parsed? 

I tested this a bit further and I can have a second shortcode on a page if it has a different name.

Link to comment
Share on other sites

Sure - here is my sortcode setup

$shortcode = $modules->get('MarkupShortcodes');

$shortcode->add('youtube', function($atts){
    return '<iframe width="560" height="315" src="http://www.youtube.com/embed/'.$atts['name'].'" frameborder="0" allowfullscreen></iframe>';
});

$shortcode->add('myname', function($atts){
    return 'My name is '.$atts['name'];
});

Here is what is in my content page.

One Bedroom

[youtube name="Akmcolo_ETE" ]One Bedroom - this one does not appear after I add the second one below

 

One Bedroom with Whirlpool

[youtube name="bD0D_LotZQo" ]Two Bedroom

 

[myname name="JIM" /] - testing  a second shortcode

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...