• My theme has a video section that gets the videos from a custom field.
    Here is the code in Single.php:

    <?php if($npdv_options['enableVideo'] == 1) { ?>
    				<?php if ( in_category($npdv_options["videoCatID"]) ): ?>
    					<object type="application/x-shockwave-flash" style="width:510px; height:280px; margin-bottom:15px;" data="<?php echo get_post_meta($post->ID, 'video', true); ?>">
    					<param name="wmode" value="opaque" /><param name="movie" value="<?php echo get_post_meta($post->ID, 'video', true); ?>" /></object>
    				<?php endif; ?>
    			<?php } ?>

    My question is that how I can replace this code with a new code that shows ProPlayer and gets the video from the custom field “video”?

    http://ww.wp.xz.cn/extend/plugins/proplayer/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Use this code, i think this should work (worked for me):

    <?php
    							print insert_proplayer(
    								 array(
    									"width" => "510",
    									"height" => "280",
    								 ),
    								get_post_meta($post->ID, 'VIDEO', $single=true)
    							);
    						?>

    Greetings!

    This is the same code but using IF

    <?php $VIDEO = get_post_meta($post->ID, 'VIDEO', $single = true); ?>
    						<?php if($VIDEO !== '') { ?>
    						<?php
    							print insert_proplayer(
    								 array(
    									"width" => "510",
    									"height" => "280",
    								 ),
    								get_post_meta($post->ID, 'VIDEO', $single=true)
    							);
    						?>
    						<?php } ?>

    Greetings!

    Thread Starter bluebird2

    (@bluebird2)

    I couldn’t make it work. I added your suggested codes there but it does not show the player.

    You use the loop before? for example this is my code in my sidebar.php

    <?php query_posts('cat=4&showposts=1'); ?>
    				<?php if (have_posts()) : ?>
    				<?php while (have_posts()) : the_post(); ?>
    					<div id="noticia2">
    						<?php $VIDEO = get_post_meta($post->ID, 'VIDEO', $single = true); ?>
    						<?php if($VIDEO !== '') { ?>
    						<?php
    							print insert_proplayer(
    								 array(
    									"width" => "270",
    									"height" => "250",
    								 ),
    								get_post_meta($post->ID, 'VIDEO', $single=true)
    							);
    						?>
    						<?php } ?>
    						<?php endwhile; ?>
    						<?php else : ?>
    						<?php endif; ?>
    </div>

    The custom field is VIDEO (uppercase), insert the youtube URL for example and this should work!

    Greetings!

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

The topic ‘[Plugin: ProPlayer] Getting the video from a Custom Field’ is closed to new replies.