Title: Php add shortcode
Last modified: May 3, 2019

---

# Php add shortcode

 *  Resolved [mp3920014](https://wordpress.org/support/users/mp3920014/)
 * (@mp3920014)
 * [7 years ago](https://wordpress.org/support/topic/php-add-shortcode/)
 * I want to hide php content
    I don’t know how to use it in php
 *     ```
       <?php echo do_shortcode("[passster password="your-password"]"); ?>
       my hidden content and php
       <?php echo do_shortcode("[/passster]"); ?>
       ```
   
 * is not work

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [patrickposner](https://wordpress.org/support/users/patrickposner/)
 * (@patrickposner)
 * [7 years ago](https://wordpress.org/support/topic/php-add-shortcode/#post-11514791)
 * Hey [@mp3920014](https://wordpress.org/support/users/mp3920014/),
 * that’s not working because the do_shortcode function does not work with closing
   shortcodes.
 * But no worries, there is a special function inside of Passster which you can 
   call:
    `PS_Conditional::is_password_valid('your-password') { // right password
   was entered }`
 * Best regards,
    Patrick
 *  Thread Starter [mp3920014](https://wordpress.org/support/users/mp3920014/)
 * (@mp3920014)
 * [7 years ago](https://wordpress.org/support/topic/php-add-shortcode/#post-11518345)
 * Is good
    thank you
 *     ```
       <?php if ( true === passster\PS_Conditional::is_password_valid( '123456' ) ): ?>
       hidden content or php
       <?php endif; ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Php add shortcode’ is closed to new replies.

 * ![](https://ps.w.org/content-protector/assets/icon-256x256.png?rev=2206760)
 * [Passster - Password Protect Pages and Content](https://wordpress.org/plugins/content-protector/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/content-protector/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/content-protector/)
 * [Active Topics](https://wordpress.org/support/plugin/content-protector/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/content-protector/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/content-protector/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [mp3920014](https://wordpress.org/support/users/mp3920014/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/php-add-shortcode/#post-11518345)
 * Status: resolved