• Resolved andyt1980

    (@andyt1980)


    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

    (@davidvongries)

    Hey @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

    (@andyt1980)

    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

    (@davidvongries)

    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

    (@andyt1980)

    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.