Creating nested shortcode concept

Surely I’m not the first but after recently being asked by a visitor about nested shortcodes I figure I would fool around with the idea. Adding this snippet to the functions.php of your wordpress theme will let you fool around with the following nested shortcode [link][my_text][/link]. No tricks just pass $content into do_shortcode() and works like a charm.

 

 

add_shortcode("my_text", "my_text");
function my_text() {
 return 'nested shortcode';
}
function my_link($atts, $content = null) {
 extract(shortcode_atts(array(
 "href" => 'http://'
 ), $atts));
 return '<a href="'.$href.'">'.do_shortcode($content).'</a>';
}
add_shortcode("link", "my_link");
 

 

 [link][my_text][/link]

If you cant Download or have any Suggestions please Contact us

Newer news items:
Older news items:

 

Recommended Web Hosting For Bloggers and Designers

I recoomended Webhostings for Bloggers and Designers because I am freelancer, working with thousand clients in the worlds. Most of them will use those hosts.

vinaora vinaora
Hostting Features:
  1. Fast, Reliable, Affordable
  2. 100% Satisfaction Guarantee
  3. And More...
Special: Reach at 20% discount and 100$ for google adwords

GET STARTED

Add comment


Security code
Refresh

vinaora

Popular News

Our Website Staff

Favourites links

may tinh bang | sim so dep

luxcen viet nam
thiết kế Website
lam seo website