I'm using a membership plug in that requires me to wrap protected pages in a short code [private]content[/private]

I want to use this code in my template so my client doesn't have to manually insert it into the posts/pages.

Codex explains to use the following example if there is an opening and closing code like I have.

 echo do_shortcode('[iscorrect]'.$text_to_be_wrapped_in_shortcode.'[/iscorrect]');

Now, I have a lot of content to wrap, including HTML + PHP elements. Is there an easier way to wrap my templates than by having to re-format all my code to go inside this echo?

  • Do you want to hide all content posted in editor from wordpress admin or just part of it? – Robert hue Sep 2 '14 at 20:25
  • I would look at your membership plugin and see if they have functions that can be used instead. Then you'd just be looking at writing some kind of if statement that uses a conditional template tag from the plugin. – mrwweb Sep 2 '14 at 20:29
  • Phew, that could be tricky @mrwweb :) I'm using Magic Member and their documentation is kinda stinky. Perhaps I can get a support ticket in. – streetfire Sep 2 '14 at 20:57
  • @Roberthue It's more than hiding the_content. It's a combination of content, custom field data, etc. And not quite sure what you mean about hiding it from admin. It's going to be hidden by membership level, which is somehow picked up via the [private] tags. – streetfire Sep 2 '14 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.