Envor – Add Facebook Video to K2 Article in extrafields

Home Forums Joomla Templates Envor — Fully Multipurpose Joomla Template Envor – Add Facebook Video to K2 Article in extrafields

This topic contains 5 replies, has 2 voices, and was last updated by  CTHthemes 3 months, 3 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #14144

    Lumi
    Participant

    Supported

    Hi I would like to be able to add/embed a facebook video in a K2 Article in extrafields, can you help please with the code I need to add to the below page and where in the PHP file to add it? Thanks

    categroy_item_masonry.php

    <?php break;
    case ‘2’: # youtube video
    $icon = ‘youtube’;
    $id = array();
    // get youtube video id from link
    preg_match(‘/[\\?\\&]v=([^\\?\\&]+)/’, $postLink, $id);
    //support embed link pasted at link
    if(empty($id) || !is_array($id)){
    preg_match(‘/embed[\/]([^\\?\\&]+)[\\?]/’, $postLink, $id);
    }
    if(!empty($id[1])) : ?>
    <div class=”post-media”>
    <div class=”responsive-video” >
    <iframe src=”http://www.youtube.com/embed/<?php echo $id[1];?>” ></iframe>
    </div>
    </div>
    <?php endif;?>

    #14150

    CTHthemes
    Keymaster

    Hi, would you send me the video link?

    #14151

    Lumi
    Participant

    Supported

    <iframe src=”https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FKRSteelLtd%2Fvideos%2F214849042329325%2F&show_text=0&width=400″ width=”400″ height=”400″ style=”border:none;overflow:hidden” scrolling=”no” frameborder=”0″ allowTransparency=”true” allowFullScreen=”true”></iframe>

    Thanks

    #14153

    CTHthemes
    Keymaster

    Try this code:

    
    case '2': # youtube video 
    $icon = 'youtube';
    $id = array();
    // get youtube video id from link
    preg_match('/[\\?\\&]v=([^\\?\\&]+)/', $postLink, $id);
    //support embed link pasted at link
    if(empty($id) || !is_array($id)){
        preg_match('/embed[\/]([^\\?\\&]+)[\\?]/', $postLink, $id);
    }
    if(!empty($id[1])) : ?>
    <div class="post-media">
    	<div class="responsive-video" >
    		<iframe src="http://www.youtube.com/embed/<?php echo $id[1];?>" ></iframe>
    	</div>
    </div>
    <?php else : ?>
    <div class="post-media">
    	<div class="responsive-video" >
    		<iframe src="<?php echo $postLink;?>" width="400" height="400" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe>
    	</div>
    </div>
    
    <?php endif;?>
    

    Then add this video link to extra field: https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FKRSteelLtd%2Fvideos%2F214849042329325%2F&show_text=0&width=400

    #14172

    Lumi
    Participant

    Supported

    Hi Thanks for this. This works to a certain extent in that the videos show up but they are too wide for the category page and not wide enough for the item page. Is there any way we can embed the video so it is responsive and fits both the category box page and the item page full width and all my we have to add to the extra field is the advanced code:

    Existing roof removal and installation of new Kingspan roofing at project in Dyce.

    Posted by KR Steel Services Ltd on Monday, 3 April 2017

    See Embedded Video Player Configurator
    https://developers.facebook.com/docs/plugins/embedded-video-player/?prefill_href=https%3A%2F%2Fwww.facebook.com%2FKRSteelLtd%2Fvideos%2F214849042329325%2F#configurator
    Thanks for you help.

    #14177

    CTHthemes
    Keymaster

    Hi, send me the page link to check.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.