Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter michaelmurf

    (@michaelmurf)

    Hi again Marty – so I’ve been testing this on my WordPress site and cannot get it to work. Could it be that your plugin might be conflicting with my theme or another plugin?

    I know that the problem is not with either my custom fields (since when I echo those custom fields individually without the conditional statement, they show up fine). Further, the “else” code (which is designed to show my custom field “Video”) is what always gets displayed no matter what browser or device I’m using. In other words, it’s like the page just isn’t able to tell when I’m accessing it through my iphone (since when I view the source code on my iphone’s safari browser it showed me the “else” code for the “Video” custom field…and NOT the “if” code for the “iPhoneVideo” custom field).

    I’ve tried this on both regular WP and Multisite WP by uploading the plugin or specified files to the proper directories…and neither has worked.

    I am using WordPress 3.0.4 and version 2.0 of your plugin. One other point of confusion is that in your changelog for the plugin you have a version 2.1 referenced, but I couldn’t find anywhere to download 2.1.

    Any and all help is much appreciated.

    Best,
    Michael

    Thread Starter michaelmurf

    (@michaelmurf)

    Hi Marty – Thanks for all the tips and advice in this thread. I’ve been learning along the way and think I’ve found the solution that will work for me using your plugin. It would consist of creating 3 custom fields: (1) iPhoneVideo, (2) iPadVideo, and (3) Video. Each field would contain the video embed code (or image) for its corresponding device (which I would manage in the WordPress admin panel for each post). Then in the template file there would be an elseif statement that would check for iphone (and if iphone then display iphone code), if it wasn’t an iphone then it would check for ipad (and if it was ipad it would display the ipad code) and if it wasn’t iphone or ipad, then it would display whatever other code I wanted it to. I’m still pretty new at this and was wondering if you could check to see if I wrote this correctly below. Note that I am applying the_content filter so that I can include shortcodes in my custom fields (for iPhoneVideo, iPadVideo, and Video).

    <div class="video_main">
    <?php
    if (is_iphone()) {
    	echo apply_filters('the_content', get_post_meta($post->ID, 'iPhoneVideo', true));
    } elseif (is_ipad()) {
    	echo apply_filters('the_content', get_post_meta($post->ID, 'iPadVideo', true));
    } else {
    	echo apply_filters('the_content', get_post_meta($post->ID, 'Video', true));
    }
    ?>
    </div>

    Thanks!
    Michael

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