Guest User

Untitled

a guest
Jun 21st, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. $post = get_queried_object();
  2.  
  3. if ( function_exists( 'pmpro_has_membership_access' ) ) {
  4.  
  5. // Check if the user has access to the post.
  6. $hasaccess = pmpro_has_membership_access( $post->ID );
  7.  
  8. // Display Advanced Custom Fields if the user has access to the post.
  9. if( ! empty( $hasaccess ) && function_exists( 'get_field' ) ) {
  10.  
  11. if ( get_field( 'test_field_1' ) ) {
  12. the_field( 'test_field_1' );
  13. }
  14.  
  15. if ( get_field( 'test_field_2' ) ) {
  16. the_field( 'test_field_2' );
  17. }
  18. }
  19. }
Add Comment
Please, Sign In to add comment