• Is there a way to enable this plugin for custom fields ?

    Let’s say I’m paste this code in custom field named embed

    [youtube]https://www.youtube.com/watch?v=k8fLRPETv_0[/youtube]

    ————————————

    then I’m showing like this

    <?php query_posts(‘tag=video&showposts=1’); ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php woo_get_custom(’embed’); ?>
    <?php endwhile; ?>

    ————————————

    And the function woo_get_custom is here:

    // Get Custom Embed
    function woo_get_custom($key, $width=0, $height=0) {

    global $post;
    $custom_field = get_post_meta($post->ID, $key, true);

    if ($custom_field) {

    if ($width == 0) :
    // Get custom width and height
    $width = get_post_meta($post->ID, ‘width’, true);
    $height = get_post_meta($post->ID, ‘height’, true);
    endif;

    // Set values
    if ( !$width ) $width = ‘width=”313″‘; else $width = ‘width=”‘.$width.'”‘;
    if ( !$height ) $height = ‘height=”250″‘; else $height = ‘height=”‘.$height.'”‘;

    $custom_field = preg_replace( ‘/width=”[^”]+”/’ , $width , $custom_field );
    $custom_field = preg_replace( ‘/height=”[^”]+”/’ , $height , $custom_field );
    ?>
    <div class=”video”>
    <?php echo $custom_field; ?>
    </div>
    <?php
    }
    else { //else, return
    return;
    }
    }

    Thank you very much, great job ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • $custom_field = apply_filters( 'the_content', $custom_field );

    That’ll replace the shortcode with the embedded video.

    If you need to modify the width/height of the video, use vvq_shortcodeatts filter.

    add_filter( 'vvq_shortcodeatts', 'your_function' );
    
    function your_function( $atts, $tag, $rawatts ) {
    	if ( is_home() ) {
    		$atts['width'] = 123;
    		$atts['height'] = 456;
    	}
    
    	return $atts;
    }

    this method doesn’t appear to work with QuickTime embeds. qtobject.js doesn’t get attached.

    thanks!

    Thread Starter zalog

    (@xxxxxcata)

    Thank you very very much, Viper007Bond, but…

    My new function is like this:

    //  Get Custom Embed
    function woo_get_custom($key) {
    	global $post;
    	$custom_field = get_post_meta($post->ID, $key, true);
    	$custom_field = apply_filters( 'the_content', $custom_field );
    	if ($custom_field) {
    ?>
    
    <div class="video">
    	<?php echo $custom_field; ?>
    </div>
    
    <?php
    	}
    	else { //else, return
    		return;
    	}
    }

    I want to call it like this

    <?php woo_get_custom('embed','354','272');  ?>

    Notice that I want to give custom width and height on this video.
    (I’am a beginner in php)

    Sorry, but I can’t code up custom code for everyone who asks.

    You’re on your own.

    Thread Starter zalog

    (@xxxxxcata)

    Hmmm, I hate this attitude … you did a great job but close this if your are not offering support. I have over 3000 visits/day on my blog, I was wanted to write about you and your quick feedback/support, but now I’m disappointed. For you it was a matter of 5 or 10 minutes. For me it’s harder. I make xhtml & css & flash , not php.

    Hmmm, I hate this attitude … you did a great job but close this if your are not offering support.

    It’s okay, I hate your attitude too. ??

    It’s a free plugin, one which I spent countless hours coding and will result in very little benefit for me. Just because I wrote a plugin and released it does not mean I am required to support it. Infact the license pretty much says exactly that.

    I’m happy to spend a little time offering basic support for my plugin and it’s code, but I’m not going to sit down and write code for you just because you don’t know how and aren’t willing to learn.

    Thread Starter zalog

    (@xxxxxcata)

    aren’t willing to learn

    Hmm, I want to learn ?? I am a xhtml, css developer.
    Here you have https://portfolio.webworks.ro/
    I have there websites like BMW ??
    Anyway thanks for your support.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can you make Viper’s Video Quicktags to work with a custom field too ?’ is closed to new replies.