WordPress.org

Ready to get started?Download WordPress

Forums

How to embed a Youtube Video on the User description? (4 posts)

  1. poliquinp
    Member
    Posted 2 years ago #

    Hi,

    I have to create the users/writters descriptions on my blog and I would like to embed a Youtube Video I've made for each one.

    When I paste the link of the video in the description, nothing happen.. I only see the link in text...

    I use the plugin wp-youtube-lyte for my posts and pages but how I can work with Users?

    Do I have to install an other plugin? I should create a page or what?

    Thx in advance...

  2. tigtog
    Member
    Posted 2 years ago #

    You will probably need to do a bit of mucking around with both your user.php template and your functions.php file to insert the relevant video for each user in their user description field.

    It's my bedtime an hour ago, so I can't give you more than that general pointer right now.

  3. poliquinp
    Member
    Posted 2 years ago #

    The problem is this :

    1- I can have new users everytimes, so I can't go in my user.php and do some if(user = "Your name"){ echo 'Youtube'}

    2- The "User description" generate text only... no HTML

    ---

    I tried the shortcode [youtube] and it didn't work as expected.. When I check on the page, I see something like this : [youtube=http://www.youtube.com/watch?v=XXXXXXXXX-X]

    Any clues?

  4. poliquinp
    Member
    Posted 2 years ago #

    Found a solution

    Here's how I did to place a Youtube video on my Author page

    Step 1
    You need to enter the Youtube share link into a field in the administration... I used Jabber / GTalk and change the title for "Youtube Link"

    Step 2
    In your author.php file, you need to get the value of the above field and call it into a variable.

    $link = $curauth->jabber;
    $pieces = explode("/", $link);
    ?>

    This part of code use a specific function found on the web to retrive some information...
    If I echo $link, I get this http://youtu.be/XXXXXXX-XX for exemple.
    Then after, with the explode PHP function, I explode in array the text everytimes it founds a /
    So,

    $pieces[0] = http:
    $pieces[1] =
    $pieces[2] = youtu.be
    $pieces[3] = XXXXXXX-XX

    The $pieces[3] is the one I actually search.

    Step 3
    Call your iframe and echo the $pieces[3] into the link.
    <iframe width="560" height="349" src="http://www.youtube.com/embed/<?php echo $pieces[3]; ?>" frameborder="0" allowfullscreen></iframe>

    Hope this help some one!

Topic Closed

This topic has been closed to new replies.

About this Topic