Reputation: 519
I'm using Memberium to create a membership site. To set the different levels of memberships I need to use shortcodes. I need to write these shortcodes in the template files but they only works on Wordpress editor.
I'm trying this:
<?php echo do_shortcode('[memb_has_membership memberships=normal]');?>
<h1>HELLO</h1>
<?php echo do_shortcode('[/memb_has_membership]');?>
Also, I have been tried without the echo, and writing only HTML...
Upvotes: 0
Views: 288
Reputation: 36
Have you tried combining everything into one call?
<?php
$str = "[memb_has_membership memberships=normal]<h1>HELLO</h1>[/memb_has_membership]";
echo do_shortcode($str);
?>
A cleaner way would be to use the plugin's PHP functions directly in your code.
The shortcode's function is member_hasMembership()
(Documentation)
<?php if(memb_hasMembership( ‘Gold’ )): ?>
<h1>HELLO</h1>
<?php endif; ?>
Upvotes: 2