thomasgriffin / theme

Theme for Pippinsplugins.com
2 stars 3 forks source link

Video metabox is gone #38

Closed pippinsplugins closed 9 years ago

pippinsplugins commented 9 years ago

The current site has a video metabox where the URL to a video is entered. The video is then rendered on the page.

This has to be brought back as it's how all member tutorial videos are done.

For example:

Staging: https://staging.pippinsplugins.com/plugin-development-101-what-makes-a-plugin/

Live: https://pippinsplugins.com/plugin-development-101-what-makes-a-plugin/

The video is displayed in the template file like this:

get_template_part('part', 'video');

Then in part-video.php

<?php

include("includes/MobileDetect.php");
$MobileDetect = new MobileDetect();

global $user_ID;
if(get_post_meta(get_the_ID(), 'pp_premium', true)) {
    if ( has_post_format( 'video' ) && rcp_is_active($user_ID)) { ?>
            <div id="post-video">
                <?php if( strpos( get_post_meta(get_the_ID(), 'pp_mp4', true), 'vimeo' ) ) : ?>
                    <?php
                    $video = get_post_meta(get_the_ID(), 'pp_mp4', true );
                    echo wp_oembed_get( $video, 'vimeo' );
                    ?>
                <?php else : ?>
                    <video id="video1" poster="<?php bloginfo('stylesheet_directory'); ?>/images/video-poster.jpg" class="sublime" <?php if( ! $MobileDetect->IsMobile() ) { echo 'width="570" height="360"'; } ?> data-uid="" preload="none">
                      <source src="<?php echo get_post_meta(get_the_ID(), 'pp_mp4', true); ?>" type="video/mp4" <?php if( ! $MobileDetect->IsMobile() ) { echo 'data-quality="hd"'; } ?> />
                      <source src="<?php echo get_post_meta(get_the_ID(), 'pp_ogv', true); ?>" type="video/ogg" <?php if( ! $MobileDetect->IsMobile() ) { echo 'data-quality="hd"'; } ?> />
                    </video>
                <?php endif; ?>
            </div>
        <?php
    } else {
        echo '<img src="' . get_bloginfo('stylesheet_directory') . '/images/video-restricted.jpg"/>';
    }
} else {
    if ( has_post_format( 'video' )) { ?>
        <div id="post-video">
            <?php if( strpos( get_post_meta(get_the_ID(), 'pp_mp4', true), 'vimeo' ) ) : ?>
                <?php
                $video = get_post_meta(get_the_ID(), 'pp_mp4', true );
                echo wp_oembed_get( $video, 'vimeo' );
                ?>
            <?php else : ?>
                <video id="video1" poster="<?php bloginfo('stylesheet_directory'); ?>/images/video-poster.jpg" class="sublime" <?php if( ! $MobileDetect->IsMobile() ) { echo 'width="570" height="360"'; } ?> data-uid="" preload="none">
                  <source src="<?php echo get_post_meta(get_the_ID(), 'pp_mp4', true); ?>" type="video/mp4" <?php if( ! $MobileDetect->IsMobile() ) { echo 'data-quality="hd"'; } ?> />
                  <source src="<?php echo get_post_meta(get_the_ID(), 'pp_ogv', true); ?>" type="video/ogg" <?php if( ! $MobileDetect->IsMobile() ) { echo 'data-quality="hd"'; } ?> />
                </video>
            <?php endif; ?>
        </div>
        <?php
    }
}
``
pippinsplugins commented 9 years ago

Posts that display a video get a post format of video

amdrew commented 9 years ago

@pippinsplugins From the code it looks like it had multiple input fields where you added a URL for each format, ogv and mp4. It also looks like you had a checkbox for whether or not the video was premium, pp_premium.

Is that all correct? I've checked your old theme and plugins and the actual creation of the checkbox and input fields are not there, how were these added?

pippinsplugins commented 9 years ago

Only MP4 is used now

On Thursday, December 18, 2014, Andrew Munro notifications@github.com wrote:

@pippinsplugins https://github.com/pippinsplugins From the code it looks like it had multiple input fields where you added a URL for each format, ogv and mp4. It also looks like you had a checkbox for whether or not the video was premium, pp_premium.

Is that all correct? I've checked your old theme and plugins but it's not in there.

— Reply to this email directly or view it on GitHub https://github.com/pippinsplugins/theme/issues/38#issuecomment-67591954.

amdrew commented 9 years ago

Videos look to be all good now https://staging.pippinsplugins.com/plugin-development-101-general-best-practices/

Just need to make them responsive, thinking of using fitvids.js for this

amdrew commented 9 years ago

Oh and I need to make an image that shows when access to video is denied. This look ok? https://gist.github.com/sumobi/090e2cfae41be9e7d723

amdrew commented 9 years ago

Videos are responsive now, double check the above snippet and we should be good on this.

pippinsplugins commented 9 years ago

Video looks great!

One small thing: looks like this isn't quite working. As a site admin I should be able to see it. Here's a tweaked snippet: https://gist.github.com/pippinsplugins/66d3354d4259cfc5e0a9

amdrew commented 9 years ago

Updated. Everything about video looks good to me.