• Add-ons
  • Blog
  • Resources
    • Documentation
    • FAQs
    • Code snippets
    • Use cases
    • Support
  • Account
    • My account
    • Checkout
    • Cart
  • English
  • French
  • Add-ons
  • Blog
  • Resources
    • Documentation
    • FAQs
    • Code snippets
    • Use cases
    • Support
  • Account
    • My account
    • Checkout
    • Cart
  • English
  • French
home/Knowledge Base/Code snippets/Detect if you are on a page in the customer area

Detect if you are on a page in the customer area

85 views 0 April 13, 2021 vprat

The code snippet below will allow you to detect whether or not you are trying to view a page of WP Customer Area or any other private content in your chart.

<?php if ( cuar_is_customer_area_page( get_queried_object_id() ) ) : ?>
  <p>We are currently showing one of the Customer Area pages</p>
<?php endif; ?>

<?php if ( cuar_is_customer_area_private_content( get_the_ID() ) ) : ?>
  <p>The current post in the loop has one of the private content post types: <?php echo get_post_type(); ?></p>
<?php endif; ?>

You should simply insert that code in the template where you want to display the menu – for example: header.php, page.php, etc.

Tags:theme

Was this helpful?

Yes  No
Related Articles
  • Custom admin notification’s recipients
  • Disable CSS resets and allow integration of third party plugins
  • Automatically add a user to a group
  • Changing the default page shown by the Customer Area
  • Changing the page shown after logout
  • Sidebars: how to disable them
Knowledge base
  • Code snippets
  • Use cases
  • Community links
Documentations
  • Getting started
  • Using code snippets
  • The template system
  • Full documentation
FAQ
  • About licences
  • Pre-sales questions
  • After-sales questions
  • Plugin usage
  • Technical questions
  • Payments
Support
  • Pre-sales Enquiries
  • Main plugin support
  • Premium add-ons support
  • Feature Requests
  • Terms and conditions for sales
  • Refund policy
  • Privacy Policy
  • Legal notices
  • Copyright 2021 wp-customerarea.com. All Rights Reserved.