| 开发者 | mtariqsmd |
|---|---|
| 更新时间 | 2026年10月8日 20:45 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
amortexa-mortgage-calculator folder to the /wp-content/plugins/ directory, or install the plugin through the WordPress admin Plugins screen.Yes. The block is server-rendered: the initial results and amortization table are computed in PHP from the block's attributes, so the calculator is usable with scripting disabled. JavaScript only adds live recalculation while typing and draws the charts.
A 30-year loan produces 360 monthly rows, which would bloat every page load. Rows are aggregated annually to keep pages fast; the underlying schedule is still calculated month by month, so the per-year figures are accurate.
Turn on Show costs and fill in the recurring costs you actually pay: property tax, home insurance, HOA fees, PMI, and any other monthly costs. The results then show a Total monthly cost alongside principal and interest, plus what you would pay out of pocket in total over the life of the loan. The payment composition chart gains a slice per cost, and the amortization schedule carries them through year by year.
Every cost that can reasonably be quoted as a rate has a unit switch, so you can enter, for example, property tax as 1.25% or as a cash amount such as $1850 a year. Percentage costs are worked out from the purchase price. Only the components you turn on are rendered, so an existing calculator keeps exactly the field list it already had.
As soon as the loan balance reaches 80% of the original purchase price, unless that happens later in the schedule. Federal rules require a lender to cancel PMI automatically at 78% and allow you to request cancellation from 80%, so Amortexa uses 80%: it never charges PMI past what you would actually be entitled to stop, and it stops as early as the rules permit. If your loan starts at 80% LTV or below, PMI is not charged at all.
Yes. Set it per block using the block's "Currency symbol" setting, site-wide under the Amortexa menu, or programmatically with the amortexa_currency_symbol filter. Each block can also place the symbol before the amount ($99) or after it (99 €) using the "Currency position" setting. Amounts are formatted with your locale's number separators.
Yes. Send a POST request to /wp-json/amortexa-mortgage-calculator/v1/calculate with a JSON body such as { "amount": 300000, "down_payment": 60000, "interest_rate": 6.5, "term_years": 30 }. Pass "with_schedule": true to include the amortization schedule in the response.
The endpoint is a stateless calculator that returns only public arithmetic and no private data, so it is open to unauthenticated requests by design. If you need to require authentication, return false from the amortexa_rest_calculate_allowed filter.
Calls are rate limited per client address: 30 requests per minute by default, after which the endpoint answers 429 Too Many Requests with a Retry-After header. Adjust it with the amortexa_rest_calculate_rate_limit and amortexa_rest_calculate_rate_window filters, or return 0 from the first to switch throttling off. Buckets are keyed on the remote address only, because forwarded headers can be forged; behind a proxy or CDN, return a trusted client address from the amortexa_rate_limit_client_key filter so visitors are not grouped together.
The [amortexa-mortgage-calculator] shortcode is supported alongside the block and accepts every loan, cost, layout, panel, skin, chart and schedule attribute. The per-element appearance settings from the Design tab are block-only, because they are styled by your site-wide defaults and a shortcode cannot sensibly reproduce a design token map. On the Amortexa > Shortcode tab each exposed attribute has an input, and a sample shortcode rebuilds and copies as you change them:
[amortexa-mortgage-calculator loanamount="350000" interestrate="4.75" loanterm="30" charttype="bar" showcosts="true" propertytax="1.25"]
Attributes are lowercase and values are wrapped in double quotes. Clearing a field leaves that attribute out, so your site-wide defaults control it instead. Add the finished shortcode to any post, page, or widget area.
Yes. Under Appearance → Widgets you will find a Mortgage Calculator widget. Drag it into a sidebar, footer, or any other widget area and set a title. It is a small wrapper around the [amortexa-mortgage-calculator] shortcode, so it renders the same calculator as the block and inherits your site-wide defaults. Only the loan amount, interest rate, loan term, layout, and skin can be overridden per widget, and any field left blank keeps the site default. The widget also appears in the block based widget editor, where you add it with the Legacy Widget block.
Filters
amortexa_skins — add or replace the available visual skins.amortexa_default_attributes — override the default loan amount, rate, term, and other block attributes.amortexa_default_settings — override the default admin settings.amortexa_calculation_result — modify the computed result before output, for example to convert currency.amortexa_currency_symbol — replace the resolved currency symbol.amortexa_cost_units — change whether a recurring cost is treated as a percentage or a cash amount.amortexa_shortcode_block — change the block attributes built from the shortcode's own attributes.amortexa_rest_calculate_allowed — return false to require authentication for the REST calculation endpoint.amortexa_rest_calculate_rate_limit — change how many calculation requests a client may make per window. Return 0 to disable rate limiting.amortexa_rest_calculate_rate_window — change the rate limit window length in seconds.amortexa_rate_limit_client_key — change the identifier used to bucket rate limited requests, for example to a CDN supplied client address.amortexa_widget_fields — add or remove fields on the calculator widget.amortexa_before_calculator_render and amortexa_after_calculator_render — fired immediately before and after the block HTML is generated.amortexa_settings_saved — fired after the admin settings have been sanitized and saved.No. See the Privacy section below.
The complete, human-readable source for this plugin is public and maintained on GitHub:
https://github.com/tariqsmd/amortexa-mortgage-calculator
The compiled files under build/ (index.js, view.js, and render.php) are generated from the unminified sources in src/ by @wordpress/scripts, which is why they are not readable line by line. The matching sources are:
build/index.js is built from src/index.js, src/edit.js, src/save.js, and the modules under src/components/ and src/utils/.build/view.js is built from src/view.js.build/render.php is compiled from src/render.php.build/style-index.css and build/index.css are compiled from src/style.scss and src/index.css.build/block.json is copied and version-synced from src/block.json.npm install
npm run build
npm run build runs wp-scripts build (Babel, webpack, and SCSS compilation), then strips byte order marks and syncs the version from the plugin header into build/block.json. npm run release additionally regenerates the translation template, renders the listing icons and banners, and assembles the WordPress.org-ready archive under dist/. The test suite runs with npm test, JavaScript and CSS with npm run lint:js and npm run lint:css, and PHP coding standards with vendor/bin/phpcs --standard=phpcs.xml.dist.
Everything ships under the GPL v2 or later. If you fork the plugin, please keep it GPL-compatible and release your version publicly.
Amortexa bundles no third-party code. Every file it loads is original to this plugin, including the charts, which are drawn in plain SVG rather than by a charting library. There is no jQuery, no Bootstrap, and no charting or animation dependency at runtime.
The packages below are used at build time only, to compile the files in build/ and assemble the release archive. None is included in the plugin and none runs on a visitor's browser:
@wordpress/scripts (MIT) - https://github.com/WordPress/gutenberg/tree/trunk/packages/scripts - Babel, webpack, and SCSS compilationsass (MIT) - https://github.com/sass/sass - SCSS compiler, pulled in by @wordpress/scriptsadm-zip (MIT) - https://github.com/cthackers/adm-zip - writes the release archivewp-pot (MIT) - https://github.com/wp-pot/wp-pot - generates the translation templateamortexa_skins, amortexa_cost_units, and amortexa_shortcode_block filters are documented.formcolumns) and panel order (panelorder).showcosts, propertytax, homeinsurance, hoafee, pmi, othercosts and their *unit counterparts — matching what the block and the editor expose.has_block() cannot detect the block.