WordPress.org

Ready to get started?Download WordPress

Forums

Viper's Video Quicktags
[resolved] Custom fields (10 posts)

  1. noidoi
    Member
    Posted 3 years ago #

    Hi,

    I have trouble with using the plugin with custom fields.
    I've searched the forum, i found only one question about this.
    http://wordpress.org/support/topic/can-you-make-vipers-video-quicktags-to-work-with-a-custom-field-too
    but i don't catch the ideea.

    I want to have the video separated by the_content() - my design requires this. (like one box for video, one for content).

    I want to be able to put in a custom field someway [flv]location[/flv]
    and show on page the video.
    Can you help me?

    Thanks a lot!

  2. noidoi
    Member
    Posted 3 years ago #

    this one works for me, but how can i put in there a custom field?

    <?php echo apply_filters( 'the_content', '[flv]location[/flv]' ); ?>

  3. Alex Mills (Viper007Bond)
    Moderator
    Plugin Author

    Posted 3 years ago #

    http://codex.wordpress.org/Custom_Fields
    http://codex.wordpress.org/Function_Reference/get_post_meta

    Put the URL in the custom field.

    <?php
    $videourl = get_post_meta( $post->ID, 'some_key', true );
    if ( $videourl )
    	echo apply_filters( 'the_content', "[flv]$videourl[/flv]" );
    ?>
  4. noidoi
    Member
    Posted 3 years ago #

    thx a lot, man :).

  5. irfanmansha
    Member
    Posted 3 years ago #

    Hi,

    In my theme, i have a custom template file where i want to show youtube and daily motion video by the video URL. I have only raw URL nothing else.

  6. kenada
    Member
    Posted 3 years ago #

    Why can't I get this code to work in my theme? Here is my code,

    <div id="video">
    <div id="video-inside">
    <?php $videourl = get_post_meta( $post->ID, 'video', true ); if ( $videourl )echo apply_filters( 'the_content', "[flv]$videourl[/flv]" ); ?>
    </div>
    </div>

    But when I load the page if loads blank. Does this no longer work?

  7. cailborg
    Member
    Posted 2 years ago #

    Replace the " " around [flv]$videourl[/flv] with ' '

  8. scruff
    Member
    Posted 2 years ago #

    I am almost there - the video shows up in the right place but the URL isn't quite right...

    code used (as above but with vimeo tags instead):

    <?php
    $videourl = get_post_meta( $post->ID, 'video', true );
    if ( $videourl )
    	echo apply_filters( 'the_content', '[vimeo]$videourl[/vimeo]' );
    ?>

    results on page:

    <span class="vvqbox vvqvimeo" style="width:635px;height:300px;"><iframe id="vvq-103-vimeo-1" src="http://player.vimeo.com/video/$videourl?title=1&byline=1&portrait=0&fullscreen=1" width="635" height="300" frameborder="0"><a href="http://www.vimeo.com/$videourl">http://www.vimeo.com/$videourl</a></iframe></span>

    it seems to be the $videourl bit that is going wrong, but i'm afraid i don't know enough about PHP to figure out why!

    WP version: 3.2.1
    example page: http://www.braincubecorp.co.uk/eatme/media/video/this-is-the-title-of-a-video-post/
    video link: http://vimeo.com/30391279

  9. xave
    Member
    Posted 2 years ago #

    Hiya

    The $videourl variable is being passed as a string.
    Try this:

    <?php
    $videourl = get_post_meta( $post->ID, 'video', true );
    if ( $videourl )
    echo apply_filters( 'the_content', '[vimeo]' . $videourl . '[/vimeo]' );
    ?>

  10. scruff
    Member
    Posted 2 years ago #

    xave, you are a star! works perfectly, thank you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic