WordPress Plugin hooks
Last updated: September 23, 2022
Available Plugin Hooks
This page focuses on the hooks the FareHarbor WordPress plugin makes available to developers. For help installing and using the plugin, see this page instead.
Shortcode Defaults
All of the shortcode option defaults that can be set in the plugin’s settings page can also be filtered via WordPress’ add_filter()
function. To filter the default shortname, for example, add the following code to your theme’s functions.php file:
add_filter( 'fareharbor/defaults/shortname', 'my_fh_default_shortname', 10, 1 );
function my_fh_default_shortname( $value ) {
// $value holds the value entered in the plugin's settings page
// or, if none is entered, the default value.
return 'myshortname';
}
Learn more about how defaults work.
Available filters
Filter | Return Value |
---|---|
fareharbor/defaults/shortname | FareHarbor shortname |
fareharbor/defaults/fallback | “simple” or “classic” |
fareharbor/defaults/asn | FareHarbor shortname |
fareharbor/defaults/asn_ref | string |
fareharbor/defaults/ref | string |
fareharbor/defaults/sheet | price sheet ID |
fareharbor/defaults/full_items | “yes” or “no” |
fareharbor/defaults/lightframe | “no” or empty string for default value (“yes”) |
FareHarbor Buttons
The FareHarbor Buttons settings can also be filtered. To activate the stylesheet, add the following to your theme’s functions.php file:
add_filter( 'fareharbor/buttons/active', '__return_true' );
To add another color (blue=00f) to the Button Colors list, use:
add_filter( 'fareharbor/buttons/query', 'my_fh_buttons_query', 10, 1 );
function my_fh_buttons_query( $value ) {
if ( $value )
$value .= '&';
return $value . 'blue=00f';
}
Lite Mode
Lite mode disables the plugin settings page and turns off the FareHarbor Buttons stylesheet. To turn on lite mode, add the following to your theme’s functions.php file:
add_filter( 'fareharbor/lite', '__return_true' );