Support » Plugins » Hacks » Adding some sort of if-then statement in posts?

  • This is kind of a weird question, but it would be awesome if I could make it work!

    I present videos on my site. I would like to be able to display ad supported videos for non-members/subscribers and no ad-infused videos for members/subscribers. I use JW Player for video. I can create two separate players; one with ads, one without.

    But the kicker is how to present the right player to the right user?

    Any ideas out there?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’d use custom fields and shortcodes for this.

    Use a custom shortcode to embed where you’d want the video to be. In that shortcode, determine if the user is a member or not. Store the videos in their own custom fields (‘ads’, ‘noads’ maybe?). Once you’ve figured out what you’re showing, just use do_shortcode to execute the video players default shortcode.

    add_shortcode('membershipVideo', 'executeMemberVideo');
    function executeMembershipVideo($args) {
        if(is_user_logged_in()) {
           // retrieve the custom field and call the player for that video
        // retrieve the custom field for non-members/call the player.

    Thanks for the help! I’ll have to look into that!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding some sort of if-then statement in posts?’ is closed to new replies.