Created
March 17, 2014 14:00
-
-
Save remyzv/9599656 to your computer and use it in GitHub Desktop.
Wordpress Json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.oneVideo').click(function(){ | |
$('.oneVideo').removeClass('active'); | |
$(this).addClass('active'); | |
var id = $(this).attr('data-id'); | |
var json = $.getJSON('http://Tigresdegarges.com/?p='+ id +'&json=1').done(function(response){ | |
var post = response.post; | |
console.log(post); | |
var customfields = post.custom_fields; | |
var provider = customfields['provider_video'][0]; | |
var auteur = customfields['auteur'][0]; | |
var date = customfields['date_video'][0] | |
var type = customfields['type_de_video'][0]; | |
var id_video = customfields['id_video'][0]; | |
var date = parseDate(date); | |
var embed; | |
if(provider == 'youtube'){ | |
embed = '<iframe height=400 width=708 src="//www.youtube.com/embed/' + id_video + '" frameborder="0" allowfullscreen></iframe>'; | |
} | |
else if(provider == 'vimeo'){ | |
embed = '<iframe src="//player.vimeo.com/video/'+ id_video +'" width=708 height=400 frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; | |
} | |
$('.big_video').fadeOut(400,function(){ | |
$('.big_video .title .categorie').html(type+ ' :'); | |
$('.big_video .title .title_content').html(post.title); | |
$('.big_video .sous_titre .auteur').html('by '+ auteur.toUpperCase()); | |
$('.big_video .sous_titre .date').html('le '+ displayDate(date,'/')); | |
$('.big_video .vignette').html(embed); | |
}); | |
$('.big_video').fadeIn(400); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment