Duplicating a function
-
I found this very useful function which allows you to hide various plugins or even just texts from users that are not logged in.
function member_check_shortcode($atts, $content = null) {
if (is_user_logged_in() && !is_null($content) && !is_feed()) {
return do_shortcode($content);
}
return ‘<p>Please register to add content.</p>’;
}
add_shortcode(‘member’, ‘member_check_shortcode’);*it works along with- [member][plugin-shortcode-here][/member]
Very useful function. However i notice that when i duplicate it in functions.php to hide a second plugin then my website returns an error.
How exactly do i duplicate the function, is there a part of the code that i should rename, and if so where exactly?
The topic ‘Duplicating a function’ is closed to new replies.