Using the ultimate shortcodes plugin (the lightbox shortcode) and some custom styling I create pop-up frequently across my site. I as trying to simplify the use-case by including the shortcode and the custom styling within a custom shortcode.
So for example This is the code that I need to type to get the desired effect:
<p style="text-align: left;">[su_lightbox type="inline" src=".123"]Some Name<i class="fa fa-chevron-right float-right"></i>[/su_lightbox]</p>
<div class="123 mfp-hide">
This is the content
</div>
And This is my attempt at turning the above into a shortcode:
// Add Shortcode
function person_shortcode( $atts , $content = null ) {
// Attributes
extract( shortcode_atts(
array(
'name' => 'name',
'numb' => 'numb',
), $atts )
);
// Code
return '<p style="text-align: left;">[su_lightbox type="inline" src=".'.$numb'"]'. $name .'<i class="fa fa-chevron-right float-right"></i>[/su_lightbox]</p>
<div class="'. $numb .' mfp-hide">
'. $content . '
</div>';
}
add_shortcode( 'person', 'person_shortcode' );
So my question is how can I make the above work?
So far I have tried replacing the su_lightbox
shortcode with its output from inside Firebug however this doesn’t work.
You could manually call
do_shortcode
on the string your shortcode callback returns. Something like the following should work:You also have a syntax error in this section of code:
You probably intended this:
I’ve fixed this in the sample above.