Anugnya Resources Manager
A WordPress plugin to allow admin to configure youtube channel and substack resource page.
by Sagacitas Technologies Private Limited · github.com/nisit/anugnya-resources · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/nisit/anugnya-resources/archive/refs/heads/main.zipAnugnya Resources Manager Plugin
Automatically pull and display YouTube videos and Substack articles on your Anugnya Holistic Care website.
📋 Features
✅ YouTube Integration
- Pull latest videos from your YouTube channel
- Uses YouTube Data API v3
- Automatic daily refresh
- Configurable number of videos
✅ Substack Integration
- Pull latest articles from your Substack
- Uses RSS feed (no API key needed)
- Automatic daily refresh
- Configurable number of articles
✅ Admin Dashboard
- View current resources
- Manual refresh buttons
- Configuration pages
- Error tracking
✅ Automatic Updates
- Daily cron job refreshes content
- Manual refresh available anytime
- Stores data locally for fast loading
📁 File Structure
anugnya-resources/
├── anugnya-resources.php # Main plugin file
├── README.md # This file
├── includes/
│ ├── admin-page.php # Dashboard overview
│ ├── youtube-settings.php # YouTube configuration
│ └── substack-settings.php # Substack configuration
└── assets/ # (optional for future use)
├── css/
└── js/
🚀 Installation
Step 1: Create Plugin Folder
wp-content/plugins/anugnya-resources/
Step 2: Upload Files
Upload these files to the folder:
anugnya-resources.php- Create
includes/folder - Upload to
includes/:admin-page.phpyoutube-settings.phpsubstack-settings.php
Step 3: Activate Plugin
- WordPress Admin > Plugins
- Find "Anugnya Resources Manager"
- Click "Activate"
Step 4: Configure
- Go to Resources in WordPress admin sidebar
- Configure YouTube settings
- Configure Substack settings
- Refresh to fetch initial data
⚙️ Configuration
YouTube Setup
Prerequisites:
- Google account
- YouTube channel
- Google Cloud Console access
Steps:
1. Get YouTube API Key:
- Go to Google Cloud Console
- Create a new project or select existing
- Enable "YouTube Data API v3"
- Go to Credentials
- Create "API Key"
- Copy the key
2. Find Your Channel ID:
Method A: YouTube Studio
- Open YouTube Studio
- Settings → Channel → Advanced
- Copy "Channel ID"
Method B: From URL
If your URL is youtube.com/channel/UCxxxxx, the part after /channel/ is your ID
3. Configure in WordPress:
- WordPress Admin > Resources > YouTube
- Paste API Key
- Paste Channel ID
- Set number of videos (1-50)
- Click "Save Settings & Refresh Videos"
Substack Setup
Prerequisites:
- Active Substack publication
- Public posts (not private/paywalled for RSS)
Steps:
1. Find Your Substack URL:
- Usually:
https://yourname.substack.com - Or your custom domain if configured
2. Configure in WordPress:
- WordPress Admin > Resources > Substack
- Enter your Substack URL
- Set number of articles (1-20)
- Click "Test Feed Connection" to verify
- Click "Save Settings & Refresh Articles"
🎯 Usage
Automatic Updates
The plugin automatically refreshes content every 24 hours via WordPress cron.
Manual Refresh
- Go to Resources in WordPress admin
- Click "Refresh YouTube Videos" or "Refresh Substack Articles"
- Data updates immediately
On Website
Resources automatically appear in your Resources section:
- YouTube videos display with thumbnail and description
- Substack articles display with title and excerpt
- Click-through links to original content
🔍 Troubleshooting
YouTube Issues
Problem: "Invalid API Key"
- Verify API key is correct
- Ensure YouTube Data API v3 is enabled in Google Cloud Console
- Check for extra spaces in the key
Problem: "No videos found"
- Verify Channel ID is correct
- Ensure channel is public, not private
- Check channel has published videos
Problem: "Quota exceeded"
- YouTube API has 10,000 units/day limit
- Each search uses ~100 units
- Wait 24 hours for quota reset
- Or increase quota in Google Cloud Console
Problem: Videos not updating
- Click manual refresh button
- Check "Last Updated" time
- Verify cron jobs are running: Tools > Site Health > Info > WordPress Constants >
DISABLE_WP_CRON
Substack Issues
Problem: "Failed to parse RSS feed"
- Verify Substack URL is correct
- Ensure URL doesn't include
/feed(plugin adds this) - Check Substack publication is public
Problem: "No articles found"
- Verify you have published posts
- Check posts are not private/paywalled
- RSS only shows public posts
Problem: No thumbnails showing
- Some Substack posts may not have images
- Plugin extracts images when available
- Fallback text displays if no image
General Issues
Problem: Admin menu not showing
- Ensure plugin is activated
- Check you have admin privileges
- Try deactivating and reactivating
Problem: Content not displaying on website
- Ensure theme is updated (uses helper functions)
- Check functions exist:
anugnya_get_youtube_videos()andanugnya_get_substack_articles() - Clear all caches
📊 Data Storage
Options Stored in WordPress
YouTube:
anugnya_youtube_api_key- API keyanugnya_youtube_channel_id- Channel IDanugnya_youtube_max_results- Number to fetchanugnya_youtube_videos- Cached video data (array)anugnya_youtube_last_update- Last refresh timestampanugnya_youtube_last_error- Last error message (if any)
Substack:
anugnya_substack_url- Substack URLanugnya_substack_max_results- Number to fetchanugnya_substack_articles- Cached article data (array)anugnya_substack_last_update- Last refresh timestampanugnya_substack_last_error- Last error message (if any)
Video Data Format
array(
'id' => 'VIDEO_ID',
'title' => 'Video Title',
'description' => 'Video description...',
'thumbnail' => 'https://...jpg',
'published_at' => '2024-01-01T12:00:00Z',
'url' => 'https://www.youtube.com/watch?v=...'
)
Article Data Format
array(
'title' => 'Article Title',
'description' => 'Article excerpt...',
'url' => 'https://...substack.com/p/...',
'published_at' => 'Mon, 01 Jan 2024 12:00:00 GMT',
'thumbnail' => 'https://...jpg',
'author' => 'Author Name'
)
🔄 Cron Jobs
The plugin schedules a daily cron job:
- Hook:
anugnya_daily_refresh - Frequency: Once per day
- Action: Refreshes both YouTube videos and Substack articles
To manually trigger:
do_action('anugnya_daily_refresh');
💻 Developer Reference
Helper Functions
Get YouTube Videos:
$videos = anugnya_get_youtube_videos();
// Returns array of video objects
Get Substack Articles:
$articles = anugnya_get_substack_articles();
// Returns array of article objects
Display in Custom Templates
<?php
$videos = anugnya_get_youtube_videos();
foreach ($videos as $video) : ?>
<div class="video">
<img src="<?php echo esc_url($video['thumbnail']); ?>">
<h3><?php echo esc_html($video['title']); ?></h3>
<p><?php echo esc_html($video['description']); ?></p>
<a href="<?php echo esc_url($video['url']); ?>">Watch</a>
</div>
<?php endforeach; ?>
Hooks and Filters
After YouTube refresh:
add_action('anugnya_youtube_refreshed', function($videos) {
// Do something after videos refresh
});
After Substack refresh:
add_action('anugnya_substack_refreshed', function($articles) {
// Do something after articles refresh
});
🔒 Security
- API keys stored securely in WordPress options
- All user inputs sanitized
- Nonce verification on all AJAX requests
- Permission checks (
manage_optionscapability) - URLs validated and escaped on output
- Remote requests use WordPress HTTP API
⚡ Performance
- Content cached in WordPress options
- No external API calls on page load
- Daily refresh via cron (not on user visits)
- Manual refresh available when needed
- Lightweight - only loads admin scripts on admin pages
📈 Limits
YouTube:
- API quota: 10,000 units/day (default)
- Each search: ~100 units
- Daily refresh: 100 units/day
- Manual refresh: 100 units per click
- Max videos per fetch: 50
Substack:
- No API limits (uses RSS)
- RSS typically shows last 10-25 posts
- No authentication required
- Works with public posts only
🆘 Support
Before Asking for Help:
- Check this README
- Verify API keys and settings
- Test feed connections
- Check WordPress debug log
- Try manual refresh
When Reporting Issues:
Include:
- WordPress version
- PHP version
- Plugin version (1.0.0)
- Error messages from admin
- Screenshot of settings page
- Whether manual refresh works
🔄 Updates
Version 1.0.0
- Initial release
- YouTube Data API v3 integration
- Substack RSS integration
- Admin dashboard
- Automatic daily refresh
- Manual refresh buttons
- Error tracking
- Test feed functionality
📝 Changelog
1.0.0 - Initial Release
- YouTube channel integration
- Substack RSS integration
- Admin configuration pages
- Automatic cron refresh
- Manual refresh capability
- Error handling and display
🎯 Future Enhancements
Potential features for future versions:
- [ ] Video/article filtering by keywords
- [ ] Custom sort order
- [ ] Shortcode support for flexible placement
- [ ] Widget support
- [ ] Vimeo integration
- [ ] Medium integration
- [ ] Custom post type for resources
- [ ] Analytics tracking
Requirements
- WordPress 5.0 or higher
- PHP 7.0 or higher
- cURL enabled (for API requests)
- WordPress cron enabled
License
GPL v2 or later
Credits
Developed for Anugnya Holistic Care
Integrates with YouTube Data API v3 and Substack RSS
📞 Quick Reference
Admin Pages:
- Dashboard:
/wp-admin/admin.php?page=anugnya-resources - YouTube:
/wp-admin/admin.php?page=anugnya-resources-youtube - Substack:
/wp-admin/admin.php?page=anugnya-resources-substack
Helper Functions:
anugnya_get_youtube_videos()anugnya_get_substack_articles()
Cron Hook:
anugnya_daily_refresh
AJAX Actions:
anugnya_refresh_youtubeanugnya_refresh_substackanugnya_test_substack_feed
Installation complete!
Go to WordPress Admin > Resources to configure your channels.