WordPress.org

Support

Support » Plugins and Hacks » User Submitted Posts » [Resolved] Help Embed Code so it show Youtube Embeds

[Resolved] Help Embed Code so it show Youtube Embeds

  • dantelex

    @dantelex

    i need to put this code in the submission-form.php so it will support youtube and other video sites

    [ Moderator note: please wrap code in backticks or use the code button. ]

    ................................................................*/
    <div class="post-block <?php echo $ct_post_class; ?>">
    
                <?php
                $video_type = get_post_meta($post->ID, 'ct_mb_post_video_type', true);
                $thumb_type = get_post_meta($post->ID, 'ct_mb_post_video_thumb', true);
                $videoid = get_post_meta($post->ID, 'ct_mb_post_video_file', true);
                $perma_link = get_permalink($post->ID);
    
                if (empty($thumb_type)) {
                    $thumb_type = 'player';
                }
    
                if ($thumb_type != 'player') {
                    $thumb_type_class = 'ct-' . $thumb_type;
                } else {
                    $thumb_type_class = '';
                }
                ?>
    
                    <?php if ($videoid != '') : ?>
                    <div class="entry-thumb <?php echo $thumb_type_class; ?>">
    
                        <?php
                        // for Youtube
                        if ($video_type == 'youtube') {
                            if ($thumb_type == 'auto') {
                                echo '<a href="' . $perma_link . '"><img src="http://img.youtube.com/vi/' . $videoid . '/0.jpg" alt="' . the_title('', '', false) . '" /></a>';
                            } else if ($thumb_type == 'featured' && has_post_thumbnail()) {
                                $not_crop = stripslashes($ct_options['ct_blog_blocks_featured_type']);
    
                                if ($ct_post_class == 'one_columns_sidebar') :
                                    $small_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'single-post-thumb-crop');
                                else :
                                    $not_crop = stripslashes($ct_options['ct_blog_blocks_featured_type']);
    
                                    if ($not_crop == 'original')
                                        $small_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'blog-thumb');
                                    else
                                        $small_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'single-post-thumb-crop');
                                endif;
    
                                echo '<a href="' . $perma_link . '"><img src="' . $small_image_url[0] . '" alt="' . the_title('', '', false) . '" /></a>';
                            }
                            else if ($thumb_type == 'player' or $thumb_type == '') {
                                echo '<iframe src="http://www.youtube.com/embed/' . $videoid . '?wmode=opaque"></iframe>';
                            } else {
                                echo '<img src="http://img.youtube.com/vi/' . $videoid . '/0.jpg" alt="' . the_title('', '', false) . '" />';
                            }
    
                            if ($thumb_type != 'player' && $thumb_type != '') {
                                echo '<div class="video youtube"><a href="' . $perma_link . '" title="' . __('Watch Youtube Video', 'color-theme-framework') . '">' . __('Youtube Video', 'color-theme-framework') . '<i class="icon-play"></i></a></div>';
                            }
                        } // endif youtube
                        // for Vimeo
                        else if ($video_type == 'vimeo') {
                            if ($thumb_type == 'auto') {
                                $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$videoid.php"));
                                echo '<a href="' . $perma_link . '"><img src="' . $hash[0]['thumbnail_large'] . '" alt="' . the_title('', '', false) . '" /></a>';
                            } else if ($thumb_type == 'featured' && has_post_thumbnail()) {
                                $not_crop = stripslashes($ct_options['ct_blog_blocks_featured_type']);
    
                                if ($ct_post_class == 'one_columns_sidebar') :
                                    $small_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'single-post-thumb-crop');
                                else :
                                    $not_crop = stripslashes($ct_options['ct_blog_blocks_featured_type']);
    
                                    if ($not_crop == 'original')
                                        $small_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'blog-thumb');
                                    else
                                        $small_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'single-post-thumb-crop');
                                endif;
    
                                echo '<a href="' . $perma_link . '"><img src="' . $small_image_url[0] . '" alt="' . the_title('', '', false) . '" /></a>';
                            }
                            else if ($thumb_type == 'player' or $thumb_type == '') {
                                echo '<iframe src="http://player.vimeo.com/video/' . $videoid . '"></iframe>';
                            } else {
                                $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$videoid.php"));
                                echo '<img src="' . $hash[0]['thumbnail_large'] . '" alt="' . the_title('', '', false) . '" />';
                            }
    
                            if ($thumb_type != 'player' && $thumb_type != '') {
                                echo '<div class="video vimeo"><a href="' . $perma_link . '" title="' . __('Watch Vimeo Video', 'color-theme-framework') . '">' . __('Vimeo Video', 'color-theme-framework') . '<i class="icon-play"></i></a></div>';
                            }
                        } //endif Vimeo
                        // for Dailymotion
                        elseif ($video_type == 'dailymotion') {
                            if ($thumb_type == 'auto') {
                                echo '<a href="' . $perma_link . '"><img src="' . getDailyMotionThumb($videoid) . '" alt="' . the_title('', '', false) . '" /></a>';
                            } else if ($thumb_type == 'featured' && has_post_thumbnail()) {
                                $not_crop = stripslashes($ct_options['ct_blog_blocks_featured_type']);
    
                                if ($ct_post_class == 'one_columns_sidebar') :
                                    $small_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'single-post-thumb-crop');
                                else :
                                    $not_crop = stripslashes($ct_options['ct_blog_blocks_featured_type']);
    
                                    if ($not_crop == 'original')
                                        $small_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'blog-thumb');
                                    else
                                        $small_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'single-post-thumb-crop');
                                endif;
    
                                echo '<a href="' . $perma_link . '"><img src="' . $small_image_url[0] . '" alt="' . the_title('', '', false) . '" /></a>';
                            }
                            else if ($thumb_type == 'player' or $thumb_type == '') {
                                echo '<iframe src="http://www.dailymotion.com/embed/video/' . $videoid . '"></iframe>';
                            } else {
                                echo '<img src="' . getDailyMotionThumb($videoid) . '" alt="' . the_title('', '', false) . '" />';
                            }
    
                            if ($thumb_type != 'player' && $thumb_type != '') {
                                echo '<div class="video dailymotion"><a href="' . $perma_link . '" title="' . __('Watch DailyMotion Video', 'color-theme-framework') . '">' . __('Dailymotion Video', 'color-theme-framework') . '<i class="icon-play"></i></a></div>';
                            }
                        } //endif Dailymotion
                        ?>
                    </div> <!-- .entry-thumb -->
                    <?php endif; ?>
    ...................................................................*/

    http://wordpress.org/plugins/user-submitted-posts/

Viewing 1 replies (of 1 total)
  • Plugin Author Jeff Starr

    @specialk

    No need to add any code — just let users add the video shortcodes directly in the post content. WordPress then will automatically display the videos in the post.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Help Embed Code so it show Youtube Embeds’ is closed to new replies.
Skip to toolbar