Skip to content

dieterDG/citatly-daily-quote

Repository files navigation

Citatly – Daily Quote

License: GPLv2

Display a new quote every day — delivered cache-safely via the WordPress REST API.

Citatly is a lightweight, zero-dependency WordPress plugin for managing quotes and displaying one automatically each day. Perfect for websites that want fresh, rotating content without complexity.

✨ Features

  • 📝 Custom Post Type for quotes with plain-text fields (text, author, extra info)
  • 📅 Daily Rotation – Same quote all day, deterministically selected via crc32(date + site_url)
  • Cache-Safe – REST API endpoint with proper HTTP caching headers; works with full-page caches and CDNs
  • 🔗 Multiple Display Methods
    • Shortcode: [citatly] with optional CSS class parameter
    • Gutenberg block (requires compiled /build directory)
    • REST API: /wp-json/citatly/v1/today
  • 🎨 Flexible Styling – BEM-style CSS classes; separators (dash, dot) can be hidden or replaced via CSS; no opinionated theme styles
  • 📤 Import/Export – Bulk manage quotes via JSON
  • 🧹 Clean Uninstall – Removes all plugin data when deleted (export your quotes first via Quotes → Import / Export)
  • 🌍 Translation-Ready – Fully translated to German (de_DE)
  • 🔒 XSS-Safe – Plain text only; no HTML stored or output

🚀 Quick Start

Installation

  1. Upload the citatly-daily-quote folder to /wp-content/plugins/
  2. Activate the plugin via Plugins in the WordPress admin
  3. Go to Quotes → Add New and create your first quote
  4. Insert [citatly] on any page, post, or widget area

The quote changes automatically at midnight (site timezone).

Basic Usage

[citatly]

With a custom CSS class:

[citatly class="my-style"]

REST API

Fetch the daily quote programmatically:

GET /wp-json/citatly/v1/today

Response:

{
  "has_quote": true,
  "text": "The only way to do great work is to love what you do.",
  "author": "Steve Jobs",
  "extra": "Stanford University, 2005"
}

📚 Documentation

Full documentation is available at citatly.com:

German documentation: citatly.com/de/docs

🎯 How It Works

The plugin selects the daily quote using a deterministic algorithm:

selected_index = crc32(today's_date + site_url) % number_of_quotes

This ensures:

  • Consistent – Same quote for all visitors on the same day
  • Cache-friendly – Works perfectly with full-page caches and CDNs
  • No sessions – No cookies or user tracking required
  • No randomness – Quote is stable throughout the day

A fallback mechanism ensures the same quote never appears on two consecutive days.

🛠️ Requirements

  • WordPress 6.0+
  • PHP 8.0+

📦 Development

Local Setup

git clone https://github.com/dieterDG/citatly-daily-quote.git
cd citatly-daily-quote

The plugin is ready to use as-is. If you want to work with the Gutenberg block:

npm install
npm run build

This generates the /build directory required for block support.

Project Structure

citatly-daily-quote/
├── citatly-daily-quote.php  # Main plugin file
├── citatly.js               # Frontend quote loader
├── citatly.css              # Skeleton loader styles
├── admin-export.js          # Import/Export UI
├── uninstall.php            # Cleanup on plugin deletion
├── readme.txt               # WordPress.org plugin directory
├── LICENSE                  # GPLv2 License
├── languages/               # Translation files (.pot, .po, .mo)
└── build/                   # Compiled block files (generated by npm)

🐛 Contributing

Found a bug? Have an idea? Open an issue or submit a pull request.

📄 License

This plugin is licensed under the GPLv2 or later. See LICENSE for details.

☕ Support

Citatly is free and always will be. If you find it useful, consider supporting the project:

Or simply give the repo a ⭐ if you like it!

🔗 Links


Made with ❤️ in Germany