title: Wordpress member acces to custom page/template
body: <p>I have made some custom templates in my wordpress and used it to build 2 pages with. Then I have tried the Members plugin for access control. It work on the pages, but it still shows my custom PHP code on that page. It there a better plugin for this or should my custom php include som standard code from wordpress to be included in the access control?</p>
  
  <pre><code>&lt;?php /* Template Name: Storfanger_indberet */ ?&gt;
  &lt;?php
  if ( ! defined( 'ABSPATH' ) ) exit;
  
  get_header(); ?&gt;
  
  &lt;div id="primary" &lt;?php generate_content_class();?&gt;&gt;
      &lt;main id="main" &lt;?php generate_main_class(); ?&gt;&gt;
          &lt;?php do_action('generate_before_main_content'); ?&gt;
          &lt;?php while ( have_posts() ) : the_post(); ?&gt;
  
              &lt;?php get_template_part( 'content', 'page' ); ?&gt;
  
              &lt;!--My code begin --&gt;
  
              &lt;?php
  If($_POST['Submit'])
  {
      // run validation if you're not doing it in js
      global $wpdb;
  
      $medlemsnr=$_POST['medlemsnr'];
      $navn=$_POST['navn'];
      $baadnavn=$_POST['baadnavn'];
      $art=$_POST['art'];
      $vaegt=$_POST['vaegt'];
      $billede=$_POST['billede'];
  
      if($wpdb-&gt;insert(
                          'ct_storfanger_indberetninger',
                          array(
                          'Medlemsnr' =&gt; $medlemsnr,
                          'navn' =&gt; $navn,
                          'bådnavn' =&gt;$baadnavn,
                          'art' =&gt;$art,
                          'vægt' =&gt;$vaegt,
                          'billede' =&gt;$billede
                          )
                      ) == false) wp_die('Der var en fejl i indsendelsen. Kontakt venligst webmaster'); else echo 'Tak for din indsendelse. Den vil fremgå af listen så snart den er godkendt af juryen!&lt;p /&gt;';
  ?&gt;
  &lt;?php
  }
  else // else we didn't submit the form, so display the form
  {
  ?&gt;
  
  &lt;form action="" method="post" id="form"&gt;
  &lt;table style="border:none;"&gt;
                  &lt;tr&gt;
                  &lt;td style="border:none;width:25%"&gt;Medlemsnr&lt;/td&gt;
                  &lt;td style="border:none;"&gt;&lt;input name="medlemsnr"     type="text" value="" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td style="border:none;"&gt;Navn&lt;/td&gt;
              &lt;td style="border:none;"&gt;&lt;input name="navn" type="text" value="" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td style="border:none;"&gt;Bådnavn&lt;/td&gt;
              &lt;td style="border:none;"&gt;&lt;input name="baadnavn" type="text" value="" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td style="border:none;"&gt;Art&lt;/td&gt;
              &lt;td style="border:none;"&gt;
                  &lt;?php 
                  global $wpdb;
                  $retrieve_data = $wpdb-&gt;get_results( "SELECT Art FROM ct_storfanger_arter");
              ?&gt;
              &lt;SELECT NAME="art"&gt;&lt;option value=""&gt;&lt;/option&gt;
              &lt;?php
                  foreach ($retrieve_data as $retrieved_data){ 
                      echo "&lt;option value='" . $retrieved_data-&gt;Art . "'&gt;" . $retrieved_data-&gt;Art . "&lt;/option&gt;";
                  }
              ?&gt;
              &lt;/SELECT&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td style="border:none;"&gt;Vægt i gram&lt;/td&gt;
              &lt;td style="border:none;"&gt;&lt;input name="vaegt" type="text" value="" /&gt; gram&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td style="border:none;"&gt;Billede&lt;/td&gt;
              &lt;td style="border:none;"&gt;&lt;input name="billede" type="file" value="" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;/table&gt;
              &lt;table style="border:none;"&gt;
              &lt;tr&gt;
              &lt;td style="border:none;"&gt;&lt;input type="submit" name="Submit" id="formsubmit" value="Indsend" /&gt;&lt;/form&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;/table&gt;
  
              &lt;/form&gt;
  &lt;?php
      } // end else no post['submit']
  ?&gt;              
  
              &lt;!--My code ends --&gt;
  
              &lt;?php
              // If comments are open or we have at least one comment, load up the comment template
              if ( comments_open() || '0' != get_comments_number() ) : ?&gt;
                  &lt;div class="comments-area"&gt;
                      &lt;?php comments_template(); ?&gt;
                  &lt;/div&gt;
              &lt;?php endif; ?&gt;
  
          &lt;?php endwhile; // end of the loop. ?&gt;
          &lt;?php do_action('generate_after_main_content'); ?&gt;
      &lt;/main&gt;&lt;!-- #main --&gt;
  &lt;/div&gt;&lt;!-- #primary --&gt;
  &lt;?php 
  do_action('generate_sidebars');
  get_footer();
  ?&gt;
  </code></pre>