Customizing the content upgrade form

The content upgrade form is added in theĀ content-upgrade.php template, but all of the fields and text are actually hooked in with this action:

<?php do_action( 'easy-content-upgrades/upgrade-form', $content_upgrade, $atts ); ?>

To add new HTML to the form, hook into the above action like so:

function ag_ecu_my_custom_form_html( $content_upgrade, $atts ) {
    ?>
    Your custom text/HTML in here.
    <?php
}

add_action( 'easy-content-upgrades/upgrade-form', 'ag_ecu_my_custom_form_html', 135, 2 );

Which priority you use (the number “135” in the above code) depends on which position you want your HTML to appear in. A full list of functions hooked in with their priority numbers is available in theĀ content-upgrades.php template file. I’ve chosen 135 in the above example, which is right between the email address field (130) and the submit button (150).

You can also remove an existing field by using the remove_action() function. You need to supply the action, the function to remove, and the priority. Here’s an example of removing the submit button field:

remove_action( 'easy-content-upgrades/upgrade-form', 'ecu_upgrade_form_submit_button', 150 )

How can we help?