Shortcode parameters

Custom Parameters

  • url, v or video: Youtube’s video URL or ID (default value = ”). Any of these is valid:
  • width or w: Set the width of the video player in pixels (default value = 560). Minimum width allowed is 200px according to Youtube.
  • height or h: Set the height of the video player in pixels (default value = 340)
  • ratio: Set the aspect ratio of the video player (default value = ’16:9′). Possible values: ’16:9′ or ’4:3′.
  • class: Add additional CSS class(es) to the player container (div or p) to position the player at your will.
  • embedcode: Set the embed code you want to use (default value = ‘new’). Possible values are ‘new’ (iframe) or ‘old’ (object).
  • version: Set the Flash player ActionScript (AS) version. Possible values are 2 or 3 (default value = 3). AS2 is deprecated (but you can still use it).
  • nocookie: Set privacy mode on or off. Possible values are 0 or 1 (default value = 0). To enable privacy mode set this to 1 and no cookies will be stored in the user’s browser.
  • title: Description of the video’s content or several tags related to it. Useful for SEO and Accessibility (WCAG 1.0+). (default value = ‘YouTube video player’)

Official Parameters

You can find in Youtube’s official documentation for player parameters all parameters explained and their possible and default values.

I’ll list them here for a quick reference grouped by player support:

  • HTML5 – AS3 – AS2
    • autohide: default value = 2.
    • autoplay: default value = 0.
    • enablejsapi: default value = 0.
    • start: default value = ”.
    • theme: default value = ‘dark’.
  • HTML5 – AS3
    • controls: default value = 1.
    • loop: default value = 0.
    • origin: default value = ”.
    • playlist: default value = ”.
  • AS3
    • color: default value = ‘red’.
    • modestbranding: default value = 0.
  • AS3 – AS2
    • cc_load_policy: default value = user’s Youtube account setting. To force subtitles set to 1.
    • disablekb: default value = 0.
    • fs: default value = 0.
    • iv_load_policy: default value = 1.
    • playerapiid: default value = ”.
    • rel: default value = 1.
    • showinfo: default value = 1.
  • AS2
    • border: default value = 0.
    • color1: default value = ‘b1b1b1′.
    • color2: default value = ‘cfcfcf’.
    • egm: default value = 0.
    • hd: default value = 0.
    • showsearch: default value = 1.

Important notes from YouTube official documentation

The modestbranding parameter is supported for the AS3 embedded player and for IFrame embeds that load the AS3 player. (Note that IFrame embeds may also load the HTML5 player, which does not support this parameter.)

The following parameters are supported in the AS2 player but have been deprecated for the newer AS3 and HTML5 players: bordercolor1color2egmhd, and showsearch.

The loop parameter has limited support in the AS3 player and in IFrame embeds, which could load either an AS3 or HTML5 player. Currently, the loop parameter only works in the AS3 player when used in conjunction with the playlist parameter. To loop a single video, set the loop parameter to 1 and set the playlist parameter value to the same video ID already specified in the url parameter:

[youtube_sc url=VIDEO_ID version=3 loop=1 playlist=VIDEO_ID]

The controls and playlist parameters are supported in the AS3 and HTML5 players but are not and will not be supported in the AS2 player.

5 thoughts on “Shortcode parameters

  1. When a page, containing a youtube_sc url=…. reference, is validated by W#C Markup Validation Service, numerous errors such as: “… missing attributes… “, “stray end tag parm” are issued. Everything seems to work correctly but why are the errors issued?

  2. how can i get all videos in a play list into the short code without having to type in every video ID? In other words, can i just feed the shortcode the playlist ID and have all the videos show up??

    • Currently, no but the next version of the plugin will allow that thanks to the new parameters google added. However this new parameters will only work for the AS3 player.

  3. Pingback: YouTube動画表示プラグイン「youtube shortcode」 | 【WPCOS】WordPressカスタマイズ

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>