Created
October 26, 2016 07:27
-
-
Save matipojo/2a56dcf482a3ab9482610a93653c1116 to your computer and use it in GitHub Desktop.
Filter out Elementor content
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
add_filter( 'elementor/frontend/the_content', function ( $content ) { | |
// 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 ) { | |
ob_start(); ?> | |
<div id="elementor" class="elementor container"> | |
<div id="elementor-inner"> | |
<div id="elementor-section-wrap"> | |
<div class="pmpro_content_message"> | |
<br><br>This content is for GoFit Concepts Monthly Program members only.<br><a href="<?php echo wp_login_url( get_permalink() ) ?>">Log In</a> | |
<a href="<?php echo esc_url( wp_registration_url() ); ?>"><?php esc_html_e( 'Register', 'textdomain' ); ?></a> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php | |
$content = ob_get_clean(); | |
} | |
return $content; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment