youtube-embed-plugin / index.html
smashmash's picture
Add 2 files
c12db6a verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>YouTube Embed Plugin for WordPress</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.fade-in {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.channel-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.video-thumbnail:hover {
transform: scale(1.03);
}
.tab-active {
border-bottom: 3px solid #3b82f6;
color: #3b82f6;
}
</style>
</head>
<body class="bg-gray-50">
<div class="container mx-auto px-4 py-8 max-w-6xl">
<div class="bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8">
<div class="flex items-center justify-between mb-6">
<div>
<h1 class="text-3xl font-bold text-gray-800 flex items-center">
<i class="fab fa-youtube text-red-600 mr-3"></i>
YouTube Embed Plugin
</h1>
<p class="text-gray-600">Embed YouTube videos automatically with powerful customization options</p>
</div>
<div class="flex space-x-3">
<button class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-save mr-2"></i> Save Settings
</button>
<button id="downloadBtn" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-download mr-2"></i> Download Plugin
</button>
</div>
</div>
<div class="border-b border-gray-200 mb-6">
<nav class="-mb-px flex space-x-8">
<button id="settings-tab" class="tab-active whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">Plugin Settings</button>
<button id="channels-tab" class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm text-gray-500 hover:text-gray-700">Manage Channels</button>
<button id="categories-tab" class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm text-gray-500 hover:text-gray-700">Post Categories</button>
<button id="preview-tab" class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm text-gray-500 hover:text-gray-700">Video Preview</button>
</nav>
</div>
<!-- Settings Tab -->
<div id="settings-content" class="fade-in">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
<div class="bg-gray-50 p-5 rounded-lg">
<h3 class="text-lg font-medium text-gray-900 mb-3">Basic Settings</h3>
<div class="space-y-4">
<div>
<label for="cache_duration" class="block text-sm font-medium text-gray-700 mb-1">Cache Duration</label>
<select id="cache_duration" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md">
<option value="3600">1 Hour</option>
<option value="10800" selected>3 Hours</option>
<option value="21600">6 Hours</option>
<option value="43200">12 Hours</option>
<option value="86400">24 Hours</option>
</select>
</div>
<div>
<label for="max_videos" class="block text-sm font-medium text-gray-700 mb-1">Max Videos to Fetch</label>
<select id="max_videos" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md">
<option value="5">5 Videos</option>
<option value="10" selected>10 Videos</option>
<option value="15">15 Videos</option>
<option value="20">20 Videos</option>
<option value="25">25 Videos</option>
</select>
</div>
<div class="flex items-center">
<input id="auto_post" name="auto_post" type="checkbox" checked class="focus:ring-blue-500 h-4 w-4 text-blue-600 border-gray-300 rounded">
<label for="auto_post" class="ml-2 block text-sm text-gray-900">Auto-post videos hourly</label>
</div>
<div class="flex items-center">
<input id="disable_cookies" name="disable_cookies" type="checkbox" class="focus:ring-blue-500 h-4 w-4 text-blue-600 border-gray-300 rounded">
<label for="disable_cookies" class="ml-2 block text-sm text-gray-900">Disable YouTube cookies in embeds</label>
</div>
</div>
</div>
<div class="bg-gray-50 p-5 rounded-lg">
<h3 class="text-lg font-medium text-gray-900 mb-3">SEO & Advanced</h3>
<div class="space-y-4">
<div>
<label for="video_layout" class="block text-sm font-medium text-gray-700 mb-1">Video Layout</label>
<select id="video_layout" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md">
<option value="grid">Grid View</option>
<option value="list" selected>List View</option>
<option value="carousel">Carousel</option>
</select>
</div>
<div class="flex items-center">
<input id="enable_seo" name="enable_seo" type="checkbox" checked class="focus:ring-blue-500 h-4 w-4 text-blue-600 border-gray-300 rounded">
<label for="enable_seo" class="ml-2 block text-sm text-gray-900">Enable SEO optimizations</label>
</div>
<div class="flex items-center">
<input id="lazy_load" name="lazy_load" type="checkbox" checked class="focus:ring-blue-500 h-4 w-4 text-blue-600 border-gray-300 rounded">
<label for="lazy_load" class="ml-2 block text-sm text-gray-900">Lazy load videos</label>
</div>
<div class="flex items-center">
<input id="show_related" name="show_related" type="checkbox" class="focus:ring-blue-500 h-4 w-4 text-blue-600 border-gray-300 rounded">
<label for="show_related" class="ml-2 block text-sm text-gray-900">Show related videos</label>
</div>
</div>
</div>
</div>
<div class="bg-gray-50 p-5 rounded-lg mb-6">
<h3 class="text-lg font-medium text-gray-900 mb-3">Feed Sources</h3>
<div class="space-y-4">
<div class="flex items-center space-x-4">
<div class="flex items-center">
<input id="feed_channel" name="feed_type" type="radio" checked class="focus:ring-blue-500 h-4 w-4 text-blue-600 border-gray-300">
<label for="feed_channel" class="ml-2 block text-sm text-gray-900">Channel Feed</label>
</div>
<div class="flex items-center">
<input id="feed_playlist" name="feed_type" type="radio" class="focus:ring-blue-500 h-4 w-4 text-blue-600 border-gray-300">
<label for="feed_playlist" class="ml-2 block text-sm text-gray-900">Playlist Feed</label>
</div>
</div>
<p class="text-sm text-gray-500">Use the Channels tab to add and manage multiple YouTube channels</p>
</div>
</div>
<div class="bg-gray-50 p-5 rounded-lg">
<h3 class="text-lg font-medium text-gray-900 mb-3">Shortcode Usage</h3>
<div class="bg-gray-800 text-gray-100 p-4 rounded-md mb-3">
<code class="text-sm">
[youtube_embed channel="UCXXXXXX" count="5" layout="grid" category="news"]
</code>
</div>
<div class="flex flex-wrap gap-2">
<div class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-xs">channel="UCXXXXXX"</div>
<div class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-xs">count="5"</div>
<div class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-xs">layout="grid"</div>
<div class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-xs">category="news"</div>
<div class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-xs">search="keyword"</div>
<div class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-xs">nocookies="true"</div>
</div>
</div>
</div>
<!-- Channels Tab -->
<div id="channels-content" class="hidden fade-in">
<div class="bg-gray-50 p-5 rounded-lg mb-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">Add New Channel</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label for="channel_id" class="block text-sm font-medium text-gray-700 mb-1">Channel ID</label>
<input type="text" id="channel_id" class="mt-1 block w-full shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm border-gray-300 rounded-md p-2" placeholder="UCxxxxxxxxxxxxxxxxx">
</div>
<div>
<label for="channel_name" class="block text-sm font-medium text-gray-700 mb-1">Display Name</label>
<input type="text" id="channel_name" class="mt-1 block w-full shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm border-gray-300 rounded-md p-2" placeholder="My YouTube Channel">
</div>
<div class="flex items-end">
<button id="add-channel-btn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-plus-circle mr-2"></i> Add Channel
</button>
</div>
</div>
<p class="mt-2 text-sm text-gray-500">Find your Channel ID in your YouTube account settings</p>
</div>
<div class="bg-white border border-gray-200 rounded-lg overflow-hidden">
<h4 class="bg-gray-50 px-4 py-3 text-sm font-medium text-gray-700 border-b border-gray-200">Your YouTube Channels</h4>
<div id="channels-list" class="divide-y divide-gray-200">
<!-- Channels will be added here dynamically -->
<div class="p-4">
<p class="text-gray-500 text-center">No channels added yet</p>
</div>
</div>
</div>
</div>
<!-- Categories Tab -->
<div id="categories-content" class="hidden fade-in">
<div class="bg-gray-50 p-5 rounded-lg mb-6">
<h3 class="text-lg font-medium text-gray-900 mb-3">Post Categories</h3>
<p class="text-sm text-gray-600 mb-4">Select which WordPress categories videos will be posted to. You can assign different categories for different channels.</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="default_category" class="block text-sm font-medium text-gray-700 mb-1">Default Category</label>
<select id="default_category" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md">
<option value="0">-- Select Category --</option>
<option value="1" selected>Videos</option>
<option value="2">News</option>
<option value="3">Tutorials</option>
<option value="4">Entertainment</option>
</select>
</div>
<div>
<label for="category_mapping" class="block text-sm font-medium text-gray-700 mb-1">Category Mapping</label>
<button id="add-mapping-btn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-plus-circle mr-2"></i> Add Channel-Category Mapping
</button>
</div>
</div>
</div>
<div class="bg-white border border-gray-200 rounded-lg overflow-hidden">
<h4 class="bg-gray-50 px-4 py-3 text-sm font-medium text-gray-700 border-b border-gray-200">Current Mappings</h4>
<div id="mappings-list" class="divide-y divide-gray-200">
<div class="grid grid-cols-12 gap-4 items-center p-4">
<div class="col-span-5 font-medium">Channel Name</div>
<div class="col-span-5 font-medium">Category</div>
<div class="col-span-2 font-medium">Actions</div>
</div>
<div class="grid grid-cols-12 gap-4 items-center p-4 bg-gray-50">
<div class="col-span-5">My YouTube Channel</div>
<div class="col-span-5">Tutorials</div>
<div class="col-span-2">
<button class="text-red-600 hover:text-red-800">
<i class="fas fa-trash-alt"></i>
</button>
</div>
</div>
<div class="grid grid-cols-12 gap-4 items-center p-4">
<div class="col-span-5">Tech Videos</div>
<div class="col-span-5">News</div>
<div class="col-span-2">
<button class="text-red-600 hover:text-red-800">
<i class="fas fa-trash-alt"></i>
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Preview Tab -->
<div id="preview-content" class="hidden fade-in">
<div class="bg-gray-50 p-5 rounded-lg mb-6">
<h3 class="text-lg font-medium text-gray-900 mb-3">Video Preview</h3>
<div class="flex flex-wrap items-center justify-between gap-4 mb-4">
<div class="flex-1 min-w-[200px]">
<label for="preview_channel" class="block text-sm font-medium text-gray-700 mb-1">Select Channel</label>
<select id="preview_channel" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md">
<option value="all">All Channels</option>
<option value="UCXXXXXX1">My YouTube Channel</option>
<option value="UCXXXXXX2">Tech Videos</option>
</select>
</div>
<div class="flex-1 min-w-[200px]">
<label for="preview_search" class="block text-sm font-medium text-gray-700 mb-1">Search Videos</label>
<input type="text" id="preview_search" class="mt-1 block w-full shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm border-gray-300 rounded-md p-2" placeholder="Search by title...">
</div>
<div class="flex-1 min-w-[200px]">
<label for="preview_sort" class="block text-sm font-medium text-gray-700 mb-1">Sort By</label>
<select id="preview_sort" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md">
<option value="date_newest">Date (Newest First)</option>
<option value="date_oldest">Date (Oldest First)</option>
<option value="title_asc">Title (A-Z)</option>
<option value="title_desc">Title (Z-A)</option>
</select>
</div>
</div>
</div>
<div id="preview-results">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Example video cards -->
<div class="bg-white border border-gray-200 rounded-lg overflow-hidden shadow-sm hover:shadow-md transition-shadow duration-200">
<div class="video-thumbnail relative pb-[56.25%] overflow-hidden transition-transform duration-200">
<img src="https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg" alt="Video thumbnail" class="absolute h-full w-full object-cover">
<div class="absolute inset-0 bg-black bg-opacity-30 flex items-center justify-center">
<div class="w-12 h-12 bg-red-600 rounded-full flex items-center justify-center">
<i class="fas fa-play text-white"></i>
</div>
</div>
<div class="absolute bottom-2 right-2 bg-black bg-opacity-70 text-white text-xs px-1.5 py-0.5 rounded">
10:24
</div>
</div>
<div class="p-4">
<h4 class="text-lg font-medium text-gray-900 mb-1 line-clamp-2">Never Gonna Give You Up - Rick Astley (Official Music Video)</h4>
<p class="text-sm text-gray-600 mb-2">My YouTube Channel • 2 days ago</p>
<p class="text-sm text-gray-500 line-clamp-2">The official video for "Never Gonna Give You Up" by Rick Astley, the song that started the Rickrolling phenomenon.</p>
<div class="mt-3 flex justify-between items-center">
<span class="text-xs text-gray-500">1.2B views</span>
<button class="text-blue-600 hover:text-blue-800 text-sm font-medium">
<i class="fas fa-plus-circle mr-1"></i> Post to Site
</button>
</div>
</div>
</div>
<div class="bg-white border border-gray-200 rounded-lg overflow-hidden shadow-sm hover:shadow-md transition-shadow duration-200">
<div class="video-thumbnail relative pb-[56.25%] overflow-hidden transition-transform duration-200">
<img src="https://i.ytimg.com/vi/9bZkp7q19f0/hqdefault.jpg" alt="Video thumbnail" class="absolute h-full w-full object-cover">
<div class="absolute inset-0 bg-black bg-opacity-30 flex items-center justify-center">
<div class="w-12 h-12 bg-red-600 rounded-full flex items-center justify-center">
<i class="fas fa-play text-white"></i>
</div>
</div>
<div class="absolute bottom-2 right-2 bg-black bg-opacity-70 text-white text-xs px-1.5 py-0.5 rounded">
4:12
</div>
</div>
<div class="p-4">
<h4 class="text-lg font-medium text-gray-900 mb-1 line-clamp-2">PSY - GANGNAM STYLE(강남스타일) M/V</h4>
<p class="text-sm text-gray-600 mb-2">Tech Videos • 1 week ago</p>
<p class="text-sm text-gray-500 line-clamp-2">The most viewed video on YouTube with over 4 billion views. PSY's global hit that took the world by storm.</p>
<div class="mt-3 flex justify-between items-center">
<span class="text-xs text-gray-500">4.5B views</span>
<button class="text-blue-600 hover:text-blue-800 text-sm font-medium">
<i class="fas fa-plus-circle mr-1"></i> Post to Site
</button>
</div>
</div>
</div>
<div class="bg-white border border-gray-200 rounded-lg overflow-hidden shadow-sm hover:shadow-md transition-shadow duration-200">
<div class="video-thumbnail relative pb-[56.25%] overflow-hidden transition-transform duration-200">
<img src="https://i.ytimg.com/vi/JGwWNGJdvx8/hqdefault.jpg" alt="Video thumbnail" class="absolute h-full w-full object-cover">
<div class="absolute inset-0 bg-black bg-opacity-30 flex items-center justify-center">
<div class="w-12 h-12 bg-red-600 rounded-full flex items-center justify-center">
<i class="fas fa-play text-white"></i>
</div>
</div>
<div class="absolute bottom-2 right-2 bg-black bg-opacity-70 text-white text-xs px-1.5 py-0.5 rounded">
3:23
</div>
</div>
<div class="p-4">
<h4 class="text-lg font-medium text-gray-900 mb-1 line-clamp-2">Ed Sheeran - Shape of You</h4>
<p class="text-sm text-gray-600 mb-2">My YouTube Channel • 3 weeks ago</p>
<p class="text-sm text-gray-500 line-clamp-2">Ed Sheeran's chart-topping hit that became one of the most streamed songs of all time.</p>
<div class="mt-3 flex justify-between items-center">
<span class="text-xs text-gray-500">3.8B views</span>
<button class="text-blue-600 hover:text-blue-800 text-sm font-medium">
<i class="fas fa-plus-circle mr-1"></i> Post to Site
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white rounded-xl shadow-md overflow-hidden p-6">
<h2 class="text-xl font-bold text-gray-800 mb-4">Plugin File Structure</h2>
<div class="bg-gray-800 text-gray-100 p-4 rounded-md mb-4">
<pre class="text-sm">
youtube-embed-plugin/
├── assets/
│ ├── css/
│ │ └── admin.css
│ ├── js/
│ │ └── admin.js
│ └── images/
│ └── icon-128x128.png
├── includes/
│ ├── class-yt-embed-admin.php
│ ├── class-yt-embed-cron.php
│ ├── class-yt-embed-feed.php
│ ├── class-yt-embed-shortcode.php
│ └── class-yt-embed-widget.php
├── languages/
├── templates/
│ ├── video-grid.php
│ ├── video-list.php
│ └── video-single.php
├── uninstall.php
├── index.php
└── youtube-embed-plugin.php</pre>
</div>
<div class="bg-blue-100 border-l-4 border-blue-500 p-4 mb-4">
<div class="flex">
<div class="flex-shrink-0">
<i class="fas fa-info-circle text-blue-500"></i>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-blue-800">Plugin Installation</h3>
<div class="mt-2 text-sm text-blue-700">
<p>To install this plugin:</p>
<ol class="list-decimal pl-5 mt-1 space-y-1">
<li>Download the zip file by clicking the button above</li>
<li>Go to WordPress admin → Plugins → Add New → Upload Plugin</li>
<li>Select the zip file and click "Install Now"</li>
<li>Activate the plugin after installation</li>
<li>Configure settings under YouTube Embed in your dashboard</li>
</ol>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// Tab switching functionality
document.addEventListener('DOMContentLoaded', function() {
const tabs = {
'settings-tab': 'settings-content',
'channels-tab': 'channels-content',
'categories-tab': 'categories-content',
'preview-tab': 'preview-content'
};
// Set up tab click handlers
Object.keys(tabs).forEach(tabId => {
const tab = document.getElementById(tabId);
const content = document.getElementById(tabs[tabId]);
tab.addEventListener('click', () => {
// Hide all content
Object.values(tabs).forEach(contentId => {
document.getElementById(contentId).classList.add('hidden');
});
// Remove active class from all tabs
Object.keys(tabs).forEach(tabId => {
document.getElementById(tabId).classList.remove('tab-active');
document.getElementById(tabId).classList.add('text-gray-500', 'hover:text-gray-700');
});
// Show selected content and mark tab as active
content.classList.remove('hidden');
tab.classList.add('tab-active');
tab.classList.remove('text-gray-500', 'hover:text-gray-700');
});
});
// Channel management
const channelsList = document.getElementById('channels-list');
const addChannelBtn = document.getElementById('add-channel-btn');
addChannelBtn.addEventListener('click', function() {
const channelId = document.getElementById('channel_id').value.trim();
const channelName = document.getElementById('channel_name').value.trim();
if (channelId && channelName) {
// Add channel to the list
const channelHtml = `
<div class="flex justify-between items-center p-4 hover:bg-gray-50">
<div class="flex items-center space-x-4">
<div class="w-10 h-10 bg-gray-200 rounded-full flex items-center justify-center">
<i class="fab fa-youtube text-red-600"></i>
</div>
<div>
<h4 class="font-medium text-gray-900">${channelName}</h4>
<p class="text-sm text-gray-500">${channelId}</p>
</div>
</div>
<div class="flex space-x-2">
<button class="text-blue-600 hover:text-blue-800 px-3 py-1 rounded">
<i class="fas fa-edit"></i>
</button>
<button class="text-red-600 hover:text-red-800 px-3 py-1 rounded">
<i class="fas fa-trash-alt"></i>
</button>
</div>
</div>
`;
if (channelsList.querySelector('.text-center')) {
channelsList.innerHTML = channelHtml;
} else {
channelsList.insertAdjacentHTML('beforeend', channelHtml);
}
// Clear inputs
document.getElementById('channel_id').value = '';
document.getElementById('channel_name').value = '';
}
});
// Download button handler (demonstration only)
document.getElementById('downloadBtn').addEventListener('click', function() {
alert('In a real implementation, this would download the plugin zip file.\n\nFor demonstration purposes, this alert shows instead.');
});
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=smashmash/youtube-embed-plugin" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>