Files
peptide-starter-theme/page-calculator.php
peptiderepo 22716b4227 fix: calc shortcode name mismatch — prc_calculator not peptide_tools_calculator (v2.1.3)
page-calculator.php and module-cards.php were both checking for
'peptide_tools_calculator' which the plugin never registered.
The calc plugin (prc) registers 'prc_calculator' — template fell
through to the 'currently being set up' fallback on every request.
2026-04-26 09:06:03 +00:00

55 lines
1.5 KiB
PHP

<?php
/**
* Template Name: Calculator
*
* Page template for the reconstitution calculator tool.
* Loads the Peptide Tools plugin calculator via shortcode.
*
* @see page-protocol-builder.php — sibling tool template
* @see functions.php — enqueue and page auto-creation
*
* What: Renders the calculator page with plugin shortcode integration.
* Who calls it: WordPress template hierarchy when a page uses this template.
* Dependencies: Peptide Tools plugin (optional — graceful fallback).
*
* @package peptide-starter
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/*
* Intentionally open to anonymous users — the reconstitution calculator
* holds no PII and performs no writes. Gating it would add friction with
* no security benefit.
*/
get_header();
?>
<main id="main" class="site-main">
<section class="ps-tool-page">
<div class="ps-container">
<?php
if ( shortcode_exists( 'prc_calculator' ) ) {
echo do_shortcode( '[prc_calculator]' );
} else {
?>
<div class="ps-tool-fallback">
<h1><?php esc_html_e( 'Reconstitution Calculator', 'peptide-starter' ); ?></h1>
<p><?php esc_html_e( 'The calculator tool is currently being set up. Please check back soon.', 'peptide-starter' ); ?></p>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="ps-btn ps-btn-primary">
<?php esc_html_e( 'Return Home', 'peptide-starter' ); ?>
</a>
</div>
<?php
}
?>
</div>
</section>
</main>
<?php get_footer(); ?>