WordPress.org

Ready to get started?Download WordPress

Forums

Do_Shortcode with embed code not working (6 posts)

  1. jordash56
    Member
    Posted 2 years ago #

    I'm trying to use Custom Field types to embed Youtube videos in a more organized fashion and using the Do_Shortcode() would seem to work perfectly, however this:

    <?php echo do_shortcode('[embed]http://www.youtube.com/watch?v=K0M09Ws8vpc&feature=player_embedded[/embed]'); ?>

    Does not seem to work, however in the same single.php file this does work perfectly:

    <?php echo do_shortcode('[gallery link="file" size="thumbnail" icontag="div"]'); ?>

    I put them one after another to test them out, any ideas why the [embed] shortcode doesn't get parsed (it just shows nothing)

    If I do the embed shortcode directly into the post it works perfectly.

    Thanks,

    Jordan

  2. Triplanetary
    Member
    Posted 2 years ago #

    This doesn't really answer your question, but have you considered simply using the generic YouTube iframe code rather than the embed shortcode?

  3. jordash56
    Member
    Posted 2 years ago #

    @Triplanetary

    Yeah I tried that, the problem is the Youtube iFrame code requires the Video ID which makes it difficult for a non technical user to find (i'm trying to program for someone like that).

    I suppose I could strip out the Video ID from the Youtube URL but it would be better if I could get this shortcode working, the other advantage would be they could use multiple Video providers like Vimeo etc..

    Another thing is the Youtube embed code needs to be parsed before the page renders so that it will be able to create a post thumbnail using one of the plugins i'm using to generate video thumbnails.

  4. karenalenore
    Member
    Posted 2 years ago #

    So any luck with this? Facing the same dilemma... thought the do_shortcode would work but it returns blank for the embed. Hmm...

  5. karenalenore
    Member
    Posted 2 years ago #

  6. jordash56
    Member
    Posted 2 years ago #

    @karenalenore

    Good to know thanks, I found a different solution but the one in that thread is better.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.