I have a wordpress site which can be found here:
http://neocsatblog.mblx.hu/
On the right side you can see this links:
This urls camed from my youtube rss chanel (uploads playlist) which url is this:
https://www.youtube.com/feeds/videos.xml?channel_id=UCxnFBx6UhZS25Poa5-ZeeNg
I would like to modified this links for I can show videos in lightbox.
For example I would like to turn in to this link:
to this:
So I writed a script for it:
jQuery(document).ready(function() {
str = jQuery("#rss-4 ul li a").attr("href");
jQuery("#rss-4 ul li a").each(function() {
jQuery("#rss-4 ul li a").attr("href",str.replace(/(youtube.com)\/watch\?v\=|(youtu.be)\//g, "youtube.com/embed/"));
jQuery( '#rss-4 ul li a' ).attr( 'href', function(index, value) {
return value + '?autoplay=1';
});
//Lightview class need for the lightbox
jQuery("#rss-4 ul li a").addClass("lightview");
});
});
Unfortunetly this script dosen't do the right thing.
What it does?
The script replace all links url to the newest video url (the first item on the list).
In this case reaplace all url to
"Puzsér szár aranyért sem adná"
link url.
How can I fix this?