• I am trying to find a way to write conditional text within the content of a post or page.

    Specifically, I want to be able to switch between two shortcodes, depending on whether the user is on an iOS device or not. This is not about theme switching, this is about content within posts only.

    Specifically, I have found a plugin that displays video playlists the way I want for the desktop site using a shortcode. However, I have a different video plugin I want to use for mobile devices which also uses a shortcode.

    I have tried using the exec-PHP plugin and successfully created a conditional statement to display text in the post for iDevices vs. Desktop, but when I try to echo or return the shortcodes, they simply display in the post as text. The shortcodes are not parsed.

    Does anyone know of any way to achieve what I need to achieve, either through PHP coding that would allow me to output the correct shortcode in a way that would allow it to be parsed, or through some other solution I am not aware of?

    (btw, I know there are video players that are compatible with both desktop and iDevices: the problem is with the dimensions of the video player. A video player at, say, 640 x 360 in the desktop site is great, but it also displays at that size on the iDevice, which means it breaks out of the layout and extends outside of the margins of the iPhone screen. My purpose here is to have two different video plugins available, each with different preset dimensions, and display the appropriately sized player for each situation. I am open to suggestions of how best to accomplish this.)

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional shortcodes within a post or page’ is closed to new replies.