Title: Conditional Display
Last modified: April 9, 2020

---

# Conditional Display

 *  Resolved [andyt1980](https://wordpress.org/support/users/andyt1980/)
 * (@andyt1980)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/conditional-display/)
 * Hi,
    I’d like to add a button to my post header that would launch the video pop-
   up on click. I’ve tested it and it works great. However, my headers are added
   dynamically meaning every post header would get the button, however not every
   post will have a video on it.
 * Is there anyway to check to see if the post has the WP Video Popup shortcode,
   and if it doesn’t then not display the button trigger?.

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

 *  Plugin Author [David Vongries](https://wordpress.org/support/users/davidvongries/)
 * (@davidvongries)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/conditional-display/#post-12662576)
 * Hey [@andyt1980](https://wordpress.org/support/users/andyt1980/),
 * sure! 🙂 Would you mind sharing the code you’ve been using to add the button 
   to the header?
 * You would be want to using a hook. With that, you can add some conditional logic
   like this:
 *     ```
       if ( ! is_page( '2380' ) {
           return;
       }
       ```
   
 * so that it will only output the button on the actual page. Make sure to change
   out 2380 with the actual ID of your post 🙂
 * Hope that helps.
 * Best,
    David
 *  Thread Starter [andyt1980](https://wordpress.org/support/users/andyt1980/)
 * (@andyt1980)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/conditional-display/#post-12662611)
 * Hi,
    Thanks for the response but I don’t think that’ll work going forward as 
   there will be several posts that have a video. Basically my theme has a header
   feature built-in which allows me to add a background-image and some text/buttons
   and any HTML/PHP to it. So ideally I’d need some way of dynamically checking 
   if the post has a WP Video Popup shortode assigned to it and if it doesn’t then
   the button wouldn’t be displayed.
 *  Plugin Author [David Vongries](https://wordpress.org/support/users/davidvongries/)
 * (@davidvongries)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/conditional-display/#post-12663393)
 * I understand.
 * That sounds like it requires some more custom work or conditional logic. Personally,
   I would use something like Advanced Custom Fields to accomplish that but since
   it’s also tied to the theme’s header, I’m not sure if content can be displayed
   there dynamically.
 * Best,
    David
 *  Thread Starter [andyt1980](https://wordpress.org/support/users/andyt1980/)
 * (@andyt1980)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/conditional-display/#post-12664739)
 * Yeh I tried the ACF route but couldn’t get the URL Field to display, I may have
   to revisit it.

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

The topic ‘Conditional Display’ is closed to new replies.

 * ![](https://ps.w.org/responsive-youtube-vimeo-popup/assets/icon-256x256.png?rev
   =2711703)
 * [WP Video Popup – WordPress Video Lightbox for YouTube, Rumble & Vimeo](https://wordpress.org/plugins/responsive-youtube-vimeo-popup/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/responsive-youtube-vimeo-popup/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/responsive-youtube-vimeo-popup/)
 * [Active Topics](https://wordpress.org/support/plugin/responsive-youtube-vimeo-popup/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/responsive-youtube-vimeo-popup/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/responsive-youtube-vimeo-popup/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [andyt1980](https://wordpress.org/support/users/andyt1980/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/conditional-display/#post-12664739)
 * Status: resolved