WP Manifestindependent plugin directory
manifest / content / anugnya-resources

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

0stars
0forks

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.zip

Anugnya 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:

  1. anugnya-resources.php
  2. Create includes/ folder
  3. Upload to includes/:
    • admin-page.php
    • youtube-settings.php
    • substack-settings.php

Step 3: Activate Plugin

  1. WordPress Admin > Plugins
  2. Find "Anugnya Resources Manager"
  3. Click "Activate"

Step 4: Configure

  1. Go to Resources in WordPress admin sidebar
  2. Configure YouTube settings
  3. Configure Substack settings
  4. Refresh to fetch initial data

⚙️ Configuration

YouTube Setup

Prerequisites:

  • Google account
  • YouTube channel
  • Google Cloud Console access

Steps:

1. Get YouTube API Key:

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable "YouTube Data API v3"
  4. Go to Credentials
  5. Create "API Key"
  6. Copy the key

2. Find Your Channel ID:

Method A: YouTube Studio

  1. Open YouTube Studio
  2. Settings → Channel → Advanced
  3. 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:

  1. WordPress Admin > Resources > YouTube
  2. Paste API Key
  3. Paste Channel ID
  4. Set number of videos (1-50)
  5. 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:

  1. WordPress Admin > Resources > Substack
  2. Enter your Substack URL
  3. Set number of articles (1-20)
  4. Click "Test Feed Connection" to verify
  5. Click "Save Settings & Refresh Articles"

🎯 Usage

Automatic Updates

The plugin automatically refreshes content every 24 hours via WordPress cron.

Manual Refresh

  1. Go to Resources in WordPress admin
  2. Click "Refresh YouTube Videos" or "Refresh Substack Articles"
  3. 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() and anugnya_get_substack_articles()
  • Clear all caches

📊 Data Storage

Options Stored in WordPress

YouTube:

  • anugnya_youtube_api_key - API key
  • anugnya_youtube_channel_id - Channel ID
  • anugnya_youtube_max_results - Number to fetch
  • anugnya_youtube_videos - Cached video data (array)
  • anugnya_youtube_last_update - Last refresh timestamp
  • anugnya_youtube_last_error - Last error message (if any)

Substack:

  • anugnya_substack_url - Substack URL
  • anugnya_substack_max_results - Number to fetch
  • anugnya_substack_articles - Cached article data (array)
  • anugnya_substack_last_update - Last refresh timestamp
  • anugnya_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_options capability)
  • 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:

  1. Check this README
  2. Verify API keys and settings
  3. Test feed connections
  4. Check WordPress debug log
  5. 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_youtube
  • anugnya_refresh_substack
  • anugnya_test_substack_feed

Installation complete!
Go to WordPress Admin > Resources to configure your channels.