Yangra Calculator icon
Utilities

Yangra Calculator hooks reference

Yangra Calculator 1.0.0 has 3 actions and 10 filters, read directly from its source code on Nov 19, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when Yangra Calculator fires an action
add_action( 'yangra_calculator_before_calculate', function( $request, $definition ) {
	// Your code runs here.
}, 10, 2 );

// Change a value Yangra Calculator is about to use
add_filter( 'yangra_calculator_after_result', function( $value, $result, $definition, $calculation, $post ) {
	// Change $value here.
	return $value;
}, 10, 5 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • src/Calculator/Renderer.php line 147
    /**
     * Filters HTML shown after a result's value, inside the result, such as a
     * chart of it.
     */
    apply_filters( 'yangra_calculator_after_result', '', $result, $definition, $calculation, $post );
  • src/Rest/CalculateController.php line 165
    /**
     * Fires before a calculator is calculated through the REST API, so an add-on
     * can read what else the view script sent, such as the visitor's date.
     */
    do_action( 'yangra_calculator_before_calculate', $request, $definition );
  • src/Calculator/Renderer.php line 131
    /**
     * Filters HTML shown at the top of the results area, such as a form visitors
     * fill in before they see their results. On a multi-step calculator it is on
     * the last step, with the results.
     */
    apply_filters( 'yangra_calculator_before_results', '', $definition, $post );
  • src/Rest/CalculateController.php line 184
    /**
     * Filters what the endpoint returns, such as to add what an add-on shows with
     * the results. The browser engine has the `yangraCalculator.calculated` filter
     * for the same.
     */
    apply_filters( 'yangra_calculator_calculate_response', $response, $definition, $calculation );
  • src/Settings.php line 35
    /**
     * Filters the default settings.
     */
    apply_filters( 'yangra_calculator_default_settings', array( 'default_mode' => Repository::MODE_BROWSER, ) );
  • src/Calculator/Renderer.php line 287
    /**
     * Filters how the inputs are grouped, such as into the steps of a multi-step
     * calculator. Each group is rendered as a fieldset with the class
     * `yangra-calculator__group`, its title as the legend when it has one, and is
     * hidden while all its inputs are. Inputs in no group come after the groups.
     * No groups, the default, leaves the fields as they are.
     */
    apply_filters( 'yangra_calculator_field_groups', array(), $definition, $post );
  • yangra-calculator.php line 72
    /**
     * Fires after the Freemius SDK has been initialised for Yangra Calculator.
     */
    do_action( 'yangra_calculator_fs_loaded' );
  • src/Plugin.php line 85
    /**
     * Fires after Yangra Calculator has registered its services.
     */
    do_action( 'yangra_calculator_loaded', $this );
  • src/Admin/DefinitionMetaBox.php line 143
    /**
     * Filters the definition a new calculator starts with.
     */
    apply_filters( 'yangra_calculator_new_definition', $this->example(), $post );
  • src/Settings.php line 102
    /**
     * Filters sanitized settings before they are saved. Use this to sanitize extra
     * keys.
     */
    apply_filters( 'yangra_calculator_sanitize_settings', $clean, $input );
  • src/Admin/Templates.php line 115
    /**
     * Filters the folders templates are read from, such as one an add-on brings.
     */
    apply_filters( 'yangra_calculator_template_directories', $this->directories );
  • src/Admin/Templates.php line 136
    /**
     * Filters the templates the picker offers.
     */
    apply_filters( 'yangra_calculator_templates', $templates );
  • src/Calculator/Renderer.php line 187
    /**
     * Filters what the view script receives, such as to add what an add-on's
     * script needs.
     */
    apply_filters( 'yangra_calculator_view_config', $this->base_config( $post, $definition, $format, $can_edit ), $definition, $post );

Generated from Yangra Calculator's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Done for you

Rather have it built for you?

Tell us what should change and we’ll write and test the code using these hooks.

Plugin customisation

from $149

New features or changed behaviour, without editing the plugin’s files.

  • Built as a companion plugin, so updates never wipe it
  • Exact quote before we start
  • Tested on staging, then deployed

Typical turnaround: 3–7 business days

Choose this

Not sure which fits? Describe what you need and we’ll suggest the simplest option.

Can't find the right hook?

We can build the customisation for you. Describe what you need: