Skip to content

Hooks and filters in Annual Receipts

Like all Charitable extensions, Charitable Annual Receipts is designed to be developer-friendly, with hooks and filters that will help you customize it to your needs.

Paid Extension

Charitable Annual Receipts is a premium plugin. Get it today with one of our plugin bundles.

Filters

charitable_dompdf_options

Added in version 1.0.0

Change the options array passed to Dompdf when generating the PDF. To see all the available options, see:
https://github.com/dompdf/dompdf/blob/master/src/Options.php#L6-L286

Return Value

An array representing a set of options.

Arguments

  • $mode (string)

    The mode. Defaults to download.

charitable_pdf_mode

Added in version 1.0.0

This allows you to change the mode in which the PDF will be loaded. By default, it will automatically be downloaded, but you can change this to have it display inline.

Return Value

Either download or inline.

Arguments

  • $mode (string)

    The mode. Defaults to download.

Usage

add_filter( 'charitable_pdf_mode', function() {
    return 'inline';
} );

charitable_pdf_download_annual_receipt

Added in version 1.0.0

Use your own class for generating the PDF. The class must implement the \Charitable\Packages\Pdf\Interfaces\ClientInterface interface.

Return Value

An object that implements the \Charitable\Packages\Pdf\Interfaces\ClientInterface interface.

Arguments

  • $mode (string)

    The mode. Defaults to download.

charitable_annual_receipts_languages_directory

Added in version 1.0.0

Modify the directory where extension translations are stored.

Return Value

A string representing the path to the languages directory, relative to the wp-content/plugins directory.

Arguments

  • $mode (string)

    The mode. Defaults to download.

charitable_annual_receipts_languages_directory

Added in version 1.0.0

Modify the directory where extension translations are stored.

Return Value

A string representing the path to the languages directory, relative to the wp-content/plugins directory.

Arguments

  • $mode (string)

    The mode. Defaults to download.

charitable_annual_receipts_languages_directory

Added in version 1.0.0

Modify the directory where extension translations are stored.

Return Value

A string representing the path to the languages directory, relative to the wp-content/plugins directory.

Arguments

  • $mode (string)

    The mode. Defaults to download.

charitable_annual_receipts_theme_template_path

Added in version 1.0.0

Change the directory where template files are stored, relative to the theme/child theme.

Return Value

A string representing the path to the templates directory, relative to the theme folder.

Arguments

  • $mode (string)

    The mode. Defaults to download.

Action

charitable_annual_receipts_start

Added in version 1.0.0

Hook fired when the plugin is first loaded.

Return Value

Void

Arguments

  • $view_args (array)

    Arguments passed to the template.

charitable_before_annual_receipt

Added in version 1.0.0

Do something before the annual receipt is displayed.

Return Value

Void

Arguments

  • $view_args (array)

    Arguments passed to the template.

charitable_after_annual_receipt

Added in version 1.0.0

Do something after the annual receipt is displayed.

Return Value

Void

Arguments

  • $view_args (array)

    Arguments passed to the template.

charitable_annual_receipts_pdf_styles

Added in version 1.0.0

Add custom styles to the PDF version of the annual receipt.

Return Value

Void

Arguments

  • $view_args (array)

    Arguments passed to the template.

Usage

add_action( 'charitable_annual_receipts_pdf_styles', function() {
    echo "color: #444;";
} );
[class^="wpforms-"]
[class^="wpforms-"]
[class^="wpforms-"]
[class^="wpforms-"]
[class^="wpforms-"]
[class^="wpforms-"]
[class^="wpforms-"]
[class^="wpforms-"]
[class^="wpforms-"]
[class^="wpforms-"]