Embedding the thumbnail and video from youtube (php - Wordpress)PHP: Delete an element from an arrayHow do I get a YouTube video thumbnail from the YouTube API?Youtube dimensions wordpressShow YouTube Video when ID is in Wordpress Custom IDHow can I get video thumbnail of youtube and vimeo embed code using php?Pull Post Into PHP Page with Embedded YouTube VideoSet the WordPress thumbnail in php code (automatically)Possible to add youtube title into Wordpress [embed][/embed]?How do I embed youtube videos into wordpress with javascriptEmbedding the thumbnails Youtube Videos (php) Wordpress

Is it legal for company to use my work email to pretend I still work there?

How to format long polynomial?

Can divisibility rules for digits be generalized to sum of digits

tikz: show 0 at the axis origin

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?

Test whether all array elements are factors of a number

Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?

Is it possible to do 50 km distance without any previous training?

Finding angle with pure Geometry.

How to write a macro that is braces sensitive?

"to be prejudice towards/against someone" vs "to be prejudiced against/towards someone"

Why did Neo believe he could trust the machine when he asked for peace?

How old can references or sources in a thesis be?

Minkowski space

Have astronauts in space suits ever taken selfies? If so, how?

Why doesn't H₄O²⁺ exist?

Why, historically, did Gödel think CH was false?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

Collect Fourier series terms

Email Account under attack (really) - anything I can do?

What is the word for reserving something for yourself before others do?

Problem of parity - Can we draw a closed path made up of 20 line segments...

What do you call a Matrix-like slowdown and camera movement effect?

What typically incentivizes a professor to change jobs to a lower ranking university?



Embedding the thumbnail and video from youtube (php - Wordpress)


PHP: Delete an element from an arrayHow do I get a YouTube video thumbnail from the YouTube API?Youtube dimensions wordpressShow YouTube Video when ID is in Wordpress Custom IDHow can I get video thumbnail of youtube and vimeo embed code using php?Pull Post Into PHP Page with Embedded YouTube VideoSet the WordPress thumbnail in php code (automatically)Possible to add youtube title into Wordpress [embed][/embed]?How do I embed youtube videos into wordpress with javascriptEmbedding the thumbnails Youtube Videos (php) Wordpress






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I would like to find out the php code where you able to embed the thumbnail from a youtube video to a website and when you clic on the thumbnail the video starts to play. All of this one using a shortcode (php) to add within of the post and typing into this shortcode the Video ID (got from Youtube) that you want to post.
I have tried the follow code but it does not work and not include all my needs shown above.



Finally, I would like to join the shortcode shows below with [video] shortcode available for Wordpress, because I want to change the video player to the built-in WordPress player, which doesn't have the familiar Youtube styling.



Also, I searched the internet and I did not find all neccesary information



May you help me? Thanks in advance.



PHP Code:



function mininaturas_youtube($atts) 
extract(shortcode_atts(array(
'id' => '',
'img' => '0',
'align'=>'left'
), $atts));
$align_class='align'.$align;
return '<img src="http://img.youtube.com/vi/'.$id.'/'.$img.'.jpg" alt="" class="'.$align_class.'" />';

add_shortcode('miniatura_youtube', 'miniaturas_youtube');


To be added within of the post:



[miniatura_youtube id="3Jt7-nBfULU" img="0" align="center"]









share|improve this question




























    0















    I would like to find out the php code where you able to embed the thumbnail from a youtube video to a website and when you clic on the thumbnail the video starts to play. All of this one using a shortcode (php) to add within of the post and typing into this shortcode the Video ID (got from Youtube) that you want to post.
    I have tried the follow code but it does not work and not include all my needs shown above.



    Finally, I would like to join the shortcode shows below with [video] shortcode available for Wordpress, because I want to change the video player to the built-in WordPress player, which doesn't have the familiar Youtube styling.



    Also, I searched the internet and I did not find all neccesary information



    May you help me? Thanks in advance.



    PHP Code:



    function mininaturas_youtube($atts) 
    extract(shortcode_atts(array(
    'id' => '',
    'img' => '0',
    'align'=>'left'
    ), $atts));
    $align_class='align'.$align;
    return '<img src="http://img.youtube.com/vi/'.$id.'/'.$img.'.jpg" alt="" class="'.$align_class.'" />';

    add_shortcode('miniatura_youtube', 'miniaturas_youtube');


    To be added within of the post:



    [miniatura_youtube id="3Jt7-nBfULU" img="0" align="center"]









    share|improve this question
























      0












      0








      0


      1






      I would like to find out the php code where you able to embed the thumbnail from a youtube video to a website and when you clic on the thumbnail the video starts to play. All of this one using a shortcode (php) to add within of the post and typing into this shortcode the Video ID (got from Youtube) that you want to post.
      I have tried the follow code but it does not work and not include all my needs shown above.



      Finally, I would like to join the shortcode shows below with [video] shortcode available for Wordpress, because I want to change the video player to the built-in WordPress player, which doesn't have the familiar Youtube styling.



      Also, I searched the internet and I did not find all neccesary information



      May you help me? Thanks in advance.



      PHP Code:



      function mininaturas_youtube($atts) 
      extract(shortcode_atts(array(
      'id' => '',
      'img' => '0',
      'align'=>'left'
      ), $atts));
      $align_class='align'.$align;
      return '<img src="http://img.youtube.com/vi/'.$id.'/'.$img.'.jpg" alt="" class="'.$align_class.'" />';

      add_shortcode('miniatura_youtube', 'miniaturas_youtube');


      To be added within of the post:



      [miniatura_youtube id="3Jt7-nBfULU" img="0" align="center"]









      share|improve this question














      I would like to find out the php code where you able to embed the thumbnail from a youtube video to a website and when you clic on the thumbnail the video starts to play. All of this one using a shortcode (php) to add within of the post and typing into this shortcode the Video ID (got from Youtube) that you want to post.
      I have tried the follow code but it does not work and not include all my needs shown above.



      Finally, I would like to join the shortcode shows below with [video] shortcode available for Wordpress, because I want to change the video player to the built-in WordPress player, which doesn't have the familiar Youtube styling.



      Also, I searched the internet and I did not find all neccesary information



      May you help me? Thanks in advance.



      PHP Code:



      function mininaturas_youtube($atts) 
      extract(shortcode_atts(array(
      'id' => '',
      'img' => '0',
      'align'=>'left'
      ), $atts));
      $align_class='align'.$align;
      return '<img src="http://img.youtube.com/vi/'.$id.'/'.$img.'.jpg" alt="" class="'.$align_class.'" />';

      add_shortcode('miniatura_youtube', 'miniaturas_youtube');


      To be added within of the post:



      [miniatura_youtube id="3Jt7-nBfULU" img="0" align="center"]






      php wordpress






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 21 at 23:49









      fernanffernanf

      196




      196






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I was able to do something with an iframe, like so:



          function mininaturas_youtube_func( $atts ) 
          $a = shortcode_atts( array(
          'id' => 'dQw4w9WgXcQ'
          ), $atts);
          return '<iframe width="560" height="315" src="https://www.youtube.com/embed/' . $a["id"] . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';

          add_shortcode( 'miniatura_youtube', 'mininaturas_youtube_func' );


          You can add your other parameters in the same manner as 'id' if you need them.



          As it is noted here https://codex.wordpress.org/Shortcode_API :



          'id' => 'dQw4w9WgXcQ' just represents the default id if no other id is provided



          Hope this helps!



          Edit
          Also just for clarity I used the same short code as you



          [miniatura_youtube id="XXXXXXXXXXX"]






          share|improve this answer

























          • Many thanks for your response!! As I said above, which part of code is uploaded the thumbnail of the Youtube video in? My website will have a lot of videos embeded and I have to reduce the loading time of the site. Thanks

            – fernanf
            Mar 22 at 20:28











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290876%2fembedding-the-thumbnail-and-video-from-youtube-php-wordpress%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I was able to do something with an iframe, like so:



          function mininaturas_youtube_func( $atts ) 
          $a = shortcode_atts( array(
          'id' => 'dQw4w9WgXcQ'
          ), $atts);
          return '<iframe width="560" height="315" src="https://www.youtube.com/embed/' . $a["id"] . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';

          add_shortcode( 'miniatura_youtube', 'mininaturas_youtube_func' );


          You can add your other parameters in the same manner as 'id' if you need them.



          As it is noted here https://codex.wordpress.org/Shortcode_API :



          'id' => 'dQw4w9WgXcQ' just represents the default id if no other id is provided



          Hope this helps!



          Edit
          Also just for clarity I used the same short code as you



          [miniatura_youtube id="XXXXXXXXXXX"]






          share|improve this answer

























          • Many thanks for your response!! As I said above, which part of code is uploaded the thumbnail of the Youtube video in? My website will have a lot of videos embeded and I have to reduce the loading time of the site. Thanks

            – fernanf
            Mar 22 at 20:28















          0














          I was able to do something with an iframe, like so:



          function mininaturas_youtube_func( $atts ) 
          $a = shortcode_atts( array(
          'id' => 'dQw4w9WgXcQ'
          ), $atts);
          return '<iframe width="560" height="315" src="https://www.youtube.com/embed/' . $a["id"] . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';

          add_shortcode( 'miniatura_youtube', 'mininaturas_youtube_func' );


          You can add your other parameters in the same manner as 'id' if you need them.



          As it is noted here https://codex.wordpress.org/Shortcode_API :



          'id' => 'dQw4w9WgXcQ' just represents the default id if no other id is provided



          Hope this helps!



          Edit
          Also just for clarity I used the same short code as you



          [miniatura_youtube id="XXXXXXXXXXX"]






          share|improve this answer

























          • Many thanks for your response!! As I said above, which part of code is uploaded the thumbnail of the Youtube video in? My website will have a lot of videos embeded and I have to reduce the loading time of the site. Thanks

            – fernanf
            Mar 22 at 20:28













          0












          0








          0







          I was able to do something with an iframe, like so:



          function mininaturas_youtube_func( $atts ) 
          $a = shortcode_atts( array(
          'id' => 'dQw4w9WgXcQ'
          ), $atts);
          return '<iframe width="560" height="315" src="https://www.youtube.com/embed/' . $a["id"] . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';

          add_shortcode( 'miniatura_youtube', 'mininaturas_youtube_func' );


          You can add your other parameters in the same manner as 'id' if you need them.



          As it is noted here https://codex.wordpress.org/Shortcode_API :



          'id' => 'dQw4w9WgXcQ' just represents the default id if no other id is provided



          Hope this helps!



          Edit
          Also just for clarity I used the same short code as you



          [miniatura_youtube id="XXXXXXXXXXX"]






          share|improve this answer















          I was able to do something with an iframe, like so:



          function mininaturas_youtube_func( $atts ) 
          $a = shortcode_atts( array(
          'id' => 'dQw4w9WgXcQ'
          ), $atts);
          return '<iframe width="560" height="315" src="https://www.youtube.com/embed/' . $a["id"] . '" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';

          add_shortcode( 'miniatura_youtube', 'mininaturas_youtube_func' );


          You can add your other parameters in the same manner as 'id' if you need them.



          As it is noted here https://codex.wordpress.org/Shortcode_API :



          'id' => 'dQw4w9WgXcQ' just represents the default id if no other id is provided



          Hope this helps!



          Edit
          Also just for clarity I used the same short code as you



          [miniatura_youtube id="XXXXXXXXXXX"]







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 22 at 5:46

























          answered Mar 22 at 4:57









          KurisuboKurisubo

          215




          215












          • Many thanks for your response!! As I said above, which part of code is uploaded the thumbnail of the Youtube video in? My website will have a lot of videos embeded and I have to reduce the loading time of the site. Thanks

            – fernanf
            Mar 22 at 20:28

















          • Many thanks for your response!! As I said above, which part of code is uploaded the thumbnail of the Youtube video in? My website will have a lot of videos embeded and I have to reduce the loading time of the site. Thanks

            – fernanf
            Mar 22 at 20:28
















          Many thanks for your response!! As I said above, which part of code is uploaded the thumbnail of the Youtube video in? My website will have a lot of videos embeded and I have to reduce the loading time of the site. Thanks

          – fernanf
          Mar 22 at 20:28





          Many thanks for your response!! As I said above, which part of code is uploaded the thumbnail of the Youtube video in? My website will have a lot of videos embeded and I have to reduce the loading time of the site. Thanks

          – fernanf
          Mar 22 at 20:28



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290876%2fembedding-the-thumbnail-and-video-from-youtube-php-wordpress%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript