Seamless Donations

Developer Codex Back to Seamless DonationsBack to Codex

Introduction to Seamless Donations customization using hooks

This tutorial will show you how to tap into the power of Seamless Donations’ extensibility functions and take control over many customization options offered inside the plugin.

Why hooks?

  • Because updates will pummel your code and it makes code difficult to support and manage
  • Never modify the WordPress core: that’s what plugins and themes are for
  • Never modify the Seamless core: that’s what hooks, filters and actions, are for

Types of hooks

  • actions: does an action
  • filters: takes in a value, changes it, and outputs it
  • Most Seamless Donations hooks are filters

Where do I put my code?

  • functions.php: Often used with themes, not my first choice
  • Your own custom plugin: How I do it, and what I recommend

How do I format a plugin?

  • Put a folder in plugins, put a matching php file in that folder, put a header block in the PHP file
  • Details on header block: https://codex.wordpress.org/File_Header
  • Details on adding filters: https://codex.wordpress.org/Function_Reference/add_filter

Where do I find Seamless Donations hooks?

  • Visit https://wordpress.org/plugins/seamless-donations/
  • Scroll down to the For Developers section

Useful debugging utilities

  • seamless_donations_debug_log()
  • seamless_donations_debug_alert()

Sample project

  1. Create a custom plugin unique to this installation: seamless-custom
  2. Re-order the donation amounts so the smallest comes first
  3. Set a default donation amount that’s not just the first item
  4. Give donation amounts individual names
  5. Change the payment code ‘cmd’ sent to PayPal from _donations to _xclick

Hooks used

  • dgx_donate_giving_levels
  • seamless_donations_form_donation_section
  • seamless_donations_form_paypal_section