Home > posts > Send and Embed Vine (in WP Post) on Facebook

Send and Embed Vine (in WP Post) on Facebook

January 9Hits:0
Advertisement

I've written a bunch of functions in my theme's functions.php so that I can use a shortcode to post Vine videos, e.g [vine id="hx9LlrZxdqV"]. My functions will then grab the raw .mp4 URL and output it as a video on my post page.

The client also wants me to be add Facebook integration so that when the Post is published with the Vine shortcode in, the video is simultaneously sent to Facebook where it's embedded as video so the users can play it on Facebook as well, much like Vinescope do.

As an addition, I will also need to add the Facebook comments to to WP post and possibly also get the number of Likes and Shares for each video/Facebook post.

Here are my functions to output the Vine on Wordpress:

function vine($id) { // gets the raw .mp4 url from the vine id     $vine = file_get_contents("http://vine.co/v/{$id}");     preg_match('/property="twitter:player:stream" content="(.*?)"/', $vine, $matches);     return ($matches[1]) ? $matches[1] : false; } function vineDesc($id) {     $vine = file_get_contents("http://vine.co/v/{$id}");     preg_match('~<\s*meta\s+property="(twitter:description)"\s+content="([^"]*)~i', $vine, $matches);     return ($matches[2]) ? $matches[2] : false; } function vineAuthor($id) {     $vine = file_get_contents("http://vine.co/v/{$id}");     preg_match('~<\s*meta\s+property="(twitter:title)"\s+content="([^"]*)~i', $vine, $matches);     $authorName = preg_replace('/\'s post on Vine/', '', $matches[2]);     return ($authorName) ? $authorName : false; }   function embedVine($atts) {      extract(shortcode_atts(array(         "id" => '',     ), $atts));      $vine_id = $id;      $videourl = vine($vine_id); // assigns the raw .mp4 url from vine() function above to variable     $vineDesc = vineDesc($vine_id);     $vineAuthor = vineAuthor($vine_id);      $output = "";      $output .= "<div class='vine-video'><video class='vine-embed'><source src=". $videourl ." type='video/mp4'></video><div class='video-overlay is-visible'><img src='/wp-content/themes/hot-new-feed/images/vine-logo.png' alt='Vine' class='vine-logo' /><div class='vine-info'><span class='vine-desc'>" . $vineDesc . "</span><a class='vine-author' href='http://vine.co/v/" . $vine_id . "'> by " . $vineAuthor . " &rarr;</a></div></div>" . postShareBtn() . "</div>";      return $output;  } add_shortcode("vine", "embedVine"); 

I'm open to using Plugins but if possible I'd like to avoid using them as much as possible.

EDIT: Also, if the embedding the Vine on Facebook can't be done, it would be ok if it would just post a link to the Vine for the user to click on, and then get the comments and possibly likes/shares too to display on the Wordpress page. Thanks!

Thanks for any help :)

Related Articles

  • Send and Embed Vine (in WP Post) on FacebookJanuary 9

    I've written a bunch of functions in my theme's functions.php so that I can use a shortcode to post Vine videos, e.g [vine id="hx9LlrZxdqV"]. My functions will then grab the raw .mp4 URL and output it as a video on my post page. The client also

  • Is there still a way to send a message with a friend request on Facebook?

    Is there still a way to send a message with a friend request on Facebook?January 11

    With the new Facebook layout (timeline, etc.) friend requests are made with one click (the old pop-up box doesn't show up anymore). I tried to send a friend request to someone I hadn't seen in a while with a personal message included but I didn't see

  • Connected to China VPN but Not Sending All Traffic Over Connection; US IP, No FacebookAugust 27

    I use Astrill VPN's China server to access certain sites that are blocked outside China (yes, strange use case I know). I have been trying to split traffic so I don't lose access to sites like Facebook. After a lot of trial and error, I noticed this

  • Embed a Cognito Form into a Facebook fan pageFebruary 16

    How can a Cognito form be embedded or included into a Facebook fan page? --------------Solutions------------- I am a developer for Cognito Forms. You can use the Social media icons on the Publish page to post links to your forms. We do not currently

  • How to send user data to a new activity using Facebook Login?January 18

    I've been working in an app which uses Facebook login to identify a user. Right now, i've added the login successfully, but I need to get some user information (like name and age) and send it to a new activity. I've been searching how to do it and I'

  • Is there any way to embed browser component into game for facebook Authentication? May 19

    Say I have desktop game and I like to make it social, for that I need browser component embedded into my game ( c++ openGL) for the Authentication part. Is there any framework for that? --------------Solutions------------- I never tried myself, but y

  • How to send a not private message on Facebook?

    How to send a not private message on Facebook?September 1

    I'm trying to figure out how people are managing to send non-private messages to each other on Facebook. You see them as something like: Ian Boyd ► Kirsten Guyer: Everyone can see this message. example: I want to know how to send a not-private messag

  • Sending an email to a Facebook user, knowing only his idJanuary 1

    If I send an email to [email protected] then John will receive the message. In my address book I have the Facebook ids of my friends. Can I use those ids to send an email? I just tried [email protected] and I received "Recipient address does not

  • Can I send a message to someone who's made a friend request?May 12

    Someone's made a friend request, but I'm suspicious about the request. The only public detail is her gender, and her name. Googling her name suggests that it's a Nigerian name, so I'm worried it may be a user engaging in a scam. I'd like to be able t

  • Sending lots of messages to facebook January 8

    I'm doing a research for my masters degree and I found in a facebook a group of people (about 400 of them) that would be perfect to ask to fill my questionnaire. What I'm concerned about, is if I get marked as a spammer by facebook if I try sending 4

  • Sending a greeting to a deceased relativeOctober 17

    How can I send a message to a deceased member on Facebook if I have not asked to be friended? --------------Solutions------------- Facebook lets users block others from writing to them without first becoming Facebook friends, so if you don't see a Me

  • Program / browser extension that sends me an email or save somewhere my weekly Facebook activityMay 10

    I am looking for a browser extension (ideally Chrome) or program (ideally supporting Windows 7) to send me an email or save somewhere my Facebook activity log every week (since the Facebook activity log is only 7-day long).

  • How do I analyze vague Google Analytics data re traffic from Facebook?April 20

    We have one Facebook fan page and two personal profiles that could be sending traffic and then there are the many facebook pages of friends etc. I am also running an ad campaign from my FB account for my husband's business which has a link from his p

  • Using shortcode within shortcode with dynamic variableDecember 15

    So I've written a shortcode to generate a Loop (which shows the most recent posts), the shortcode is simply [loop]. Here's the code which outputs the content of each post (which is the bit causing me problems): $output .= "<p class='entry-content'

  • Strange logs in apache from bing/facebookMay 14

    I am used to finding some random probing from script bots in my apache log files, but today I found some strange entries: 65.55.24.247 - - [25/Apr/2014:01:52:36 +0000] "GET /calendar/caldetail/id/281/num/1328144400 HTTP/1.1" 404 439 "-"

  • play a sound when XMLHttpRequest updates dom data (AJAX)February 8

    I've been trying to figure out how to play a sound.wav file whenever a new message is received from an XMLHttpRequest to a php page that gets data from a mysql database. I found the code from this page handy Count Page DIV's, it counts the displayed

  • What's the point in having "www" in a URL?May 27

    Other than for historical reasons, is there is reason to have "www" in a URL. Should I do a permanent redirect from www.xyz.com to xyz.com or xyz.com to www.xyz.com? Which one would you suggest and why? --------------Solutions------------- One o

  • I do not have a FaceBook account but keep receiving emailsSeptember 27

    How do I stop people that I don't know emailing me to ask me to be their friend? Why do the emails that I receive think that I will know a list of people that I have never heard of? --------------Solutions------------- There is an option on Facebook

  • SitePoint Podcast #110: Louis' First ShowMay 1

    Episode 110 of The SitePoint Podcast is now available! This week the panel is made up of Louis Simoneau (@rssaddict), Patrick O'Keefe (@ifroggy), and Stephan Segraves (@ssegraves). Listen in Your Browser Play this episode directly in your browser - j

  • What are the modules that used for "Login with Twitter/Facebook"-like authentication?July 17

    What are the modules that are used for "Login with Twitter/Facebook"-like authentication (Oauth)? --------------Solutions------------- I have been working on a generic module for handling all of those kinds of "one-click" logins: the C

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.509 s.