Title: shortcode in template
Last modified: August 31, 2016

---

# shortcode in template

 *  Resolved [Bradley Pirman](https://wordpress.org/support/users/bradley-pirman/)
 * (@bradley-pirman)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-template-9/)
 * We’re trying to lock down a template to specific “labels” only in MFM.
 * If the member is signed in, we’re receiving a message but not the_content().
 * What are we doing wrong?
 * Thanks!
 * Here’s our code:
 *     ```
       $response = sf_memberonly('[memberonly label="CITAPRIL2016"]');
       if ( $response == "") {
       	the_content();
       } else {
       	echo $response;
       }
       ```
   
 * [https://wordpress.org/plugins/memberfindme-login-connector/](https://wordpress.org/plugins/memberfindme-login-connector/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [MembershipWorks](https://wordpress.org/support/users/sourcefound/)
 * (@sourcefound)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-template-9/#post-7322922)
 * Hi Bradley! This should have worked, what is the response/message you are getting?
 *  Thread Starter [Bradley Pirman](https://wordpress.org/support/users/bradley-pirman/)
 * (@bradley-pirman)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-template-9/#post-7322931)
 * Hey there! Thanks for the response.
 * I’m getting this in place of the content:
 * “[administrator info: content below memberonly label=”CITAPRIL2016″]”
 * But no content displays after that in the page. Only the footer and everything
   after the_content.
 *     ```
       <article id="post-3006" class="post-3006 page type-page status-publish hentry">
   
       					<h1 class="main_title">Coach Intensive Training — April 2016 – TESTING</h1>
   
       					<div class="entry-content">
       					[administrator info: content below memberonly label="CITAPRIL2016"]					</div> <!-- .entry-content -->
   
       				</article>
       ```
   
 *  Plugin Author [MembershipWorks](https://wordpress.org/support/users/sourcefound/)
 * (@sourcefound)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-template-9/#post-7322932)
 * Hi Bradley Pirman! That is the message shown if you are logged in as a WordPress
   administrator so that is normal. Since you are testing for no response, this 
   message causes the first IF statement to be false.
 * You will need to test on a separate browser (not a separate tab/window) where
   you are logged in as a member with the appropriate permissions (ie. have the 
   appropriate label and a renewal date that is sufficiently current).
 *  Thread Starter [Bradley Pirman](https://wordpress.org/support/users/bradley-pirman/)
 * (@bradley-pirman)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-template-9/#post-7322933)
 * Okay so I think I’m misunderstanding what the plugin is returning to $response.
   
   I read the [post here](https://wordpress.org/support/topic/shortcode-in-template-not-working-1)
   and thought that if the user had permissions, that $response would be empty. 
   So then I was trying to display the_content if $response was empty.
 * I’m looking for a way to show the_content if the user is authorized. Can you 
   help me fashion my if() to do that?
 * Thanks so much!
    /b
 *  Plugin Author [MembershipWorks](https://wordpress.org/support/users/sourcefound/)
 * (@sourcefound)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-template-9/#post-7322935)
 * Hi Bradley Pirman! that is correct, the function will return an empty string 
   given the parameter you pass it, if the user had permission as a member to access
   the content. However a WordPress administrator is not a member. So you should
   perform your testing on a separate browser, logged in as a member.
 *  Thread Starter [Bradley Pirman](https://wordpress.org/support/users/bradley-pirman/)
 * (@bradley-pirman)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-template-9/#post-7322941)
 * GREAT! Nice to know the code was in line!
    This poses a problem when Administrators
   are viewing the page. I guess I could test for the “[Administrator…]” string 
   in response instead of just the empty.
 * future idea? maybe have “unauthorized” or similar message in $response if the
   user is unauthorized.
 * Thanks so much for your help. Especially the prompt response!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘shortcode in template’ is closed to new replies.

 * ![](https://ps.w.org/memberfindme-login-connector/assets/icon-128x128.png?rev
   =998155)
 * [MembershipWorks Login Connector](https://wordpress.org/plugins/memberfindme-login-connector/)
 * [Support Threads](https://wordpress.org/support/plugin/memberfindme-login-connector/)
 * [Active Topics](https://wordpress.org/support/plugin/memberfindme-login-connector/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/memberfindme-login-connector/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/memberfindme-login-connector/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Bradley Pirman](https://wordpress.org/support/users/bradley-pirman/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-template-9/#post-7322941)
 * Status: resolved