Re is out: see what's new Lifetime updates on every purchase Support replies within 24 hours Secure checkout via Gumroad 8,500+ sales since 2016

Theme functions and constants

Updated 2 min read 10 views

Themes use these functions rather than Re:Maily’s classes, which may move between versions.

FunctionReturns
remaily_render( $id, $args )A form’s HTML. $id is the form’s short ID ('a1b2c3d') or its post ID; $args takes class and html_id.
remaily_icon( $name, $class )An icon’s SVG from templates/icons/, the theme’s copy first
remaily_import_forms( $source, $replace )Imports forms from a file made with Download forms, a URL or JSON, such as in a demo import. $replace updates forms with the same shortcode instead of adding copies.
remaily_field_info( $form, $name, $key )A field’s setting as visitors read it, as [[name:key]] prints it: remaily_field_info( ‘a1b2c3d’, ‘your_file’, ‘size’ ) returns “10 MB”. Escape it when you print it.
remaily_logo( $name )A brand logo for the admin, such as an add-on’s card or Settings card: one of Re:Maily’s own, or one an add-on registered with remaily_logos. Printed once per page, with no request.
<?php echo remaily_render( 'a1b2c3d', [ 'class' => 'my-form' ] ); ?>

Constants

Define these in wp-config.php, or in a theme’s functions.php. While one is on, Re:Maily’s admin screens show a notice about it.

ConstantWhat it does
REMAILY_DISABLE_MAILNo mail from any form. Messages are still saved in Entries. For a staging or demo site.
REMAILY_TEST_MODEEvery form in test mode: fields are checked, nothing is sent or saved.
REMAILY_MAIL_TOEvery mail goes to this one address, with Cc and Bcc dropped. For a staging site.
REMAILY_DEFAULT_STYLESfalse loads none of Re:Maily’s styles, so the theme styles every form.
define( 'REMAILY_MAIL_TO', 'me@example.com' );
Was this article helpful?