sahib_13 Posted September 23, 2015 Share Posted September 23, 2015 I am making website on wordpress and want to use opening and closing shortcode in my website's page template. In that shortcode i want to insert one more shortcode, but i don't know how to do that. Can anyone please help me how to do that ? Below written is the content which i want to insert in my page template with php code. [restrict userlevel="subscriber"][masterslider id="1"][/restrict] After spending a long time on research i found that .$content. should be used between [restrict] [/restrict] to do this . But now i don't know that how to use .$content. as [masterslider id="1"] Please let me know the full coding of this. I would be really thankful to you. Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted September 23, 2015 Share Posted September 23, 2015 This is bbcode used within an editor [restrict userlevel="subscriber"][masterslider id="1"][/restrict] To paste directly into a theme you use normal php code and echo the function/plugin parameters. Or you use wordpress built in do_shortcode() function. https://developer.wordpress.org/reference/functions/do_shortcode/ <?php if ( is_user_logged_in() ){ echo do_shortcode( '[restrict userlevel="subscriber"][masterslider id="1"][/restrict]' ); } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.