WordPress.org

Ready to get started?Download WordPress

Forums

WP YouTube Lyte
[resolved] How can I use this plugin in a theme? (7 posts)

  1. Philljc
    Member
    Posted 11 months ago #

    Hello, here's what I'm currently using with another plugin and ACF (advanced custom fields):

    <?php
    $videoId = get_sub_field('youtube_video_id');
    echo youtube_video_embed( $videoId );
    ?>

    But that plugin is slow. How can I use my videoID here with YouTube Lyte in a theme file as per the above?

    Thanks

    http://wordpress.org/extend/plugins/wp-youtube-lyte/

  2. futtta
    Member
    Plugin Author

    Posted 11 months ago #

    Hi Philljc;
    This should work;

    if(function_exists('lyte_parse')) { echo lyte_parse($video); }

    frank

  3. Philljc
    Member
    Posted 11 months ago #

    If I use:

    <?php if(function_exists('lyte_parse')) { echo lyte_parse($videoId); } ?>

    It just shows the video ID on the page :(

  4. futtta
    Member
    Plugin Author

    Posted 11 months ago #

    Yeah, sorry about that; I based my answer on feedback I received a long time ago, but the plugin evolved in the mean time and that doesn't work any more.

    You'll need to put something like this in your functions.php;

    function lyte_preparse($videoId) {
        return lyte_parse('httpv://www.youtube.com/watch?v='.$videoId);
        }

    and then indeed call lyte_preparse instead of lyte_parse.

    hope this helps,
    frank

  5. Philljc
    Member
    Posted 11 months ago #

    That did it, thanks!

    May I ask why you're using widths for the players, and why there isn't a 100% width? If there is I apologise, I wasn't able to find it.

    When I used the following (in conjunction with a container), it worked perfectly in my responsive layout for desktop/iPad/iPhone:

    .fourthree .lyte, .lyte {
    position: inherit !important;
    }

    Thanks

  6. futtta
    Member
    Plugin Author

    Posted 11 months ago #

    well, the fixed widths in the admin screen are in reality max-widths. if the video doesn't fit, it'll automatically resize to 100% of the available width :-)

  7. futtta
    Member
    Plugin Author

    Posted 10 months ago #

    Hi Philljc;
    I'm working on a new version of my plugin which will have the lyte_preparse function by default and which features an API as well.
    In case you guys want to test it, you can download the development version from http://downloads.wordpress.org/plugin/wp-youtube-lyte.zip

    Looking forward to your feedback! :-)

    frank

Reply

You must log in to post.

About this Plugin

About this Topic