Last active
January 28, 2018 10:22
-
-
Save pingram3541/6c862d72ea6f8d4f6576073d60c971ba to your computer and use it in GitHub Desktop.
How to restrict betheme content for paid membership pro - copy to child theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The template for displaying all pages. | |
* | |
* @package Betheme | |
* @author Muffin group | |
* @link http://muffingroup.com | |
*/ | |
get_header(); | |
?> | |
<!-- #Content --> | |
<div id="Content"> | |
<div class="content_wrapper clearfix"> | |
<!-- .sections_group --> | |
<div class="sections_group"> | |
<div class="entry-content" itemprop="mainContentOfPage"> | |
<?php | |
while ( have_posts() ){ | |
the_post(); // Post Loop | |
/* custom code to filter paid membership pro */ | |
$hasaccess = pmpro_has_membership_access(NULL, NULL, true); | |
if(is_array($hasaccess)){ | |
//returned an array to give us the membership level values | |
//$post_membership_levels_ids = $hasaccess[1]; //gives us all level ids | |
//$post_membership_levels_names = $hasaccess[2]; //gives us the level names | |
$hasaccess = $hasaccess[0]; | |
} | |
if($hasaccess){ | |
mfn_builder_print( get_the_ID() ); // Content Builder & WordPress Editor Content | |
} else { | |
?> | |
<div class="section_wrapper"> | |
<div class="the_content_wrapper"> | |
<p>Sorry, this page requires a Membership Account.</p> | |
</div> | |
</div> | |
<?php | |
} | |
} | |
?> | |
<div class="section section-page-footer"> | |
<div class="section_wrapper clearfix"> | |
<div class="column one page-pager"> | |
<?php | |
// List of pages | |
wp_link_pages(array( | |
'before' => '<div class="pager-single">', | |
'after' => '</div>', | |
'link_before' => '<span>', | |
'link_after' => '</span>', | |
'next_or_number' => 'number' | |
)); | |
?> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php if( mfn_opts_get('page-comments') ): ?> | |
<div class="section section-page-comments"> | |
<div class="section_wrapper clearfix"> | |
<div class="column one comments"> | |
<?php comments_template( '', true ); ?> | |
</div> | |
</div> | |
</div> | |
<?php endif; ?> | |
</div> | |
<!-- .four-columns - sidebar --> | |
<?php get_sidebar(); ?> | |
</div> | |
</div> | |
<?php get_footer(); | |
// Omit Closing PHP Tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@pingram3541
Thanks a lot for your help. Really appreciate!