Mortgage Calculators WP Shortcode

Below, you’ll find a detailed guide on how to add the Mortgage Calculators WP Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Mortgage Calculators WP Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Mortgage Calculators WP Plugin and the shortcodes it provides:

Plugin Icon
Mortgage Calculators WP

"Mortgage Calculators WP is a user-friendly WordPress plugin designed to streamline and simplify the process of calculating mortgage payments on your website."

★★★★☆ (10) Active Installs: 2000+ Tested with: 6.2.3 PHP Version: false
Included Shortcodes:
  • [mcwp]

Mortgage Calculators WP [mcwp] Shortcode

The Mortgage Calculators WP shortcode is a powerful tool that enables different types of mortgage calculations on your website. The shortcode fetches user attributes and runs a function to determine the type of mortgage calculator to display. It supports Conventional, FHA, VA, MHA, and Refinance calculators. The selected calculator is then wrapped in a form with a unique CSS class, allowing for custom styling. The form also includes a hidden field for email functionality.

Shortcode: [mcwp]

Parameters

Here is a list of all possible mcwp shortcode parameters and attributes:

  • type – Determines the type of the mortgage calculator

The type param of the shortcode can take five different values, each value corresponds to a different type of mortgage calculator.

  • cv – Loads the conventional mortgage calculator
  • fha – Loads the Federal Housing Administration (FHA) calculator
  • va – Loads the Veterans Affairs (VA) mortgage calculator
  • mha – Loads the Making Home Affordable (MHA) calculator
  • rc – Loads the Refinance Calculator

Each of these different calculator types has its own form layout and calculations, providing a unique set of features to the user.

Examples and Usage

Basic example – A shortcode to display a conventional mortgage calculator

[mcwp type='cv' /]

The above shortcode will display a conventional mortgage calculator on the page. The ‘type’ attribute is used to specify the type of calculator. In this case, ‘cv’ stands for conventional.

Advanced examples

Displaying an FHA mortgage calculator using the shortcode

[mcwp type='fha' /]

In this example, the ‘type’ attribute is set to ‘fha’, which stands for Federal Housing Administration. This will display an FHA mortgage calculator on the page.

Displaying a VA mortgage calculator using the shortcode

[mcwp type='va' /]

Here, the ‘type’ attribute is set to ‘va’, which stands for Veterans Affairs. This will display a VA mortgage calculator on the page.

Displaying a MHA mortgage calculator using the shortcode

[mcwp type='mha' /]

In this case, the ‘type’ attribute is set to ‘mha’, which stands for Making Home Affordable Program. This will display a MHA mortgage calculator on the page.

Displaying a refinance calculator using the shortcode

[mcwp type='rc' /]

Finally, when the ‘type’ attribute is set to ‘rc’, it will display a refinance calculator on the page.

PHP Function Code

In case you have difficulties debugging what causing issues with [mcwp] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('mcwp', 'mcwp_shortcode');

Shortcode PHP function:

function mcwp_shortcode($atts = array(), $content = null, $tag = '')
{
    //wpmc_enqueue(); //Load CSS & Js files
    // normalize attribute keys, lowercase
    $atts = array_change_key_case((array)$atts, CASE_LOWER);
    // override default attributes with user attributes
    $atts = shortcode_atts(array('type' => 'cv',), $atts, $tag);

    $calTemplate2 = '';
    $option_func = (use_network_settings('wpmc_mail_use_network_settings') === 'yes') ? 'get_site_option' : 'get_option';
    $mcwp_currency = $option_func('mcwp_currency');
    $curr_symbol = $mcwp_currency;

    $wrap_class = '';
    if ($atts['type'] == 'cv') {
        require_once('views/conventional.php');
        $wrap_class = 'mcalc-conventional';
    } elseif ($atts['type'] == 'fha') {
        require_once('views/fha.php');
        $wrap_class = 'mcalc-fha';
    } elseif ($atts['type'] == 'va') {
        require_once('views/va.php');
        $wrap_class = 'mcalc-va';
    } elseif ($atts['type'] == 'mha') {
        require_once('views/mha.php');
        $wrap_class = 'mcalc-ha';
    } elseif ($atts['type'] == 'rc') {
        require_once('views/rc.php');
        $wrap_class = 'mcalc-refi';
    }
    $cal_form = '<form class="mcalc '.$wrap_class.' mcalc-color" name="'.$atts['type'].'" id="id_'.$atts['type'].'">
    '.$calculator_layout.'
      <input type="hidden" name="action" value="mcwp_sendmail"/>
    </form>';

    return $cal_form;
}

Code file location:

mortgage-calculators-wp/mortgage-calculators-wp/includes/shortcodes/mcwp.php

Conclusion

Now that you’ve learned how to embed the Mortgage Calculators WP Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *