Skip to content

Instantly share code, notes, and snippets.

View gist:c53160a5f091dbc33c39
(function () {
videojs.plugin('playlist', function (options) {
var id = this.el().id;
var tracks = document.querySelectorAll("#" + id + "-vjs-playlist .vjs-track"),
trackCount = tracks.length,
player = this,
currentTrack = tracks[0],
index = 0,
play = true,
onTrackSelected = options.onTrackSelected;
@da1nonly
da1nonly / gist:6668055
Created Sep 23, 2013
youtube import wordpress
View gist:6668055
if($type == 'youtube'){
$playlist_id = $_POST['convert'];
if($old !== 'Data'){
$url = "https://gdata.youtube.com/feeds/api/playlists/".$playlist_id."?v=2&alt=json&max-results=50";
$data = json_decode(file_get_contents($url),true);
$info = $data["feed"];
$video = $info["entry"];
for($i=0;$i<count($video);$i++){
if($video[$i]['link'][0]['href'] != ""){
$text_title = str_replace("'", '', $video[$i]['title']['$t']);
View export.php
<?php
/**
* WordPress Export Administration API
*
* @package WordPress
* @subpackage Administration
*/
/**
* Version number for the export format.
View wordpress auto backup
<?php
/**
Backup the database of a given WordPress site.
using http://www.bin-co.com/blog/2008/10/remote-database-backup-wordpress-plugin/
*/
$site_url = 'http://yoursite.com'; //The URL of the online wordpress site
$username = 'admin'; // Admin username
$password = 'not_my_password'; // Admin password
View gist:2551561
<?php
function add_meta_boxes() {
wp_enqueue_style( 'mytabs-css', get_bloginfo( 'stylesheet_directory' ). '/tab/metabox-tabs.css');
wp_enqueue_script( 'mytabs', get_bloginfo( 'stylesheet_directory' ). '/tab/mytabs.js', array( 'jquery-ui-tabs' ) );
add_meta_box(
'repeatable-fields',
'Playlist',
'repeatable_meta_box_display',
'post',
View gist:2416071
jQuery('.repeatable-add').click(function() {
field = jQuery(this).closest('td').find('.custom_repeatable li:last').clone(true);
fieldLocation = jQuery(this).closest('td').find('.custom_repeatable li:last');
jQuery('input', field).val('').attr('name', function(index, name) {
return name.replace(/(\d+)/, function(fullMatch, n) {
return Number(n) + 1;
});
})
field.insertAfter(fieldLocation, jQuery(this).closest('td'))
return false;
View gist:2416055
<?php
function add_meta_boxes() {
wp_enqueue_style( 'mytabs-css', get_bloginfo( 'stylesheet_directory' ). '/tab/metabox-tabs.css');
wp_enqueue_script( 'mytabs', get_bloginfo( 'stylesheet_directory' ). '/tab/mytabs.js', array( 'jquery-ui-tabs' ) );
add_meta_box(
'repeatable-fields',
'Playlist',
'repeatable_meta_box_display',
'post',
View gist:2416044
jQuery(document).ready(function($) {
$('.metabox_submit').click(function(e) {
e.preventDefault();
$('#publish').click();
});
$('#add-row').on('click', function() {
var row = $('.empty-row.screen-reader-text').clone(true);
row.removeClass('empty-row screen-reader-text');
row.insertBefore('#repeatable-fieldset-one tbody>tr:last');
return false;
@da1nonly
da1nonly / gist:2253622
Created Mar 30, 2012
wordpress audio and video playlist metabox
View gist:2253622
<?php
function add_meta_boxes() {
wp_enqueue_style( 'mytabs-css', get_bloginfo( 'stylesheet_directory' ). '/tab/metabox-tabs.css');
wp_enqueue_script( 'mytabs', get_bloginfo( 'stylesheet_directory' ). '/tab/mytabs.js', array( 'jquery-ui-tabs' ) );
add_meta_box(
'repeatable-fields',
'Playlist',
'repeatable_meta_box_display',
'post',
@da1nonly
da1nonly / gist:2057532
Created Mar 17, 2012
wordpress meta box urls
View gist:2057532
<?php
add_action('admin_init', 'add_meta_boxes', 1);
function add_meta_boxes() {
add_meta_box( 'repeatable-fields', 'Audio Playlist', 'repeatable_meta_box_display', 'post', 'normal', 'high');
}
function repeatable_meta_box_display() {
global $post;