You can remove the percentage raised, amount raised, and donor count from the stats summary block on all campaign pages by adding some custom code. The following code will work with most WordPress themes:
function ed_unhook_default_template_functions() {
remove_action( 'charitable_campaign_summary', 'charitable_template_campaign_percentage_raised', 4 );
remove_action( 'charitable_campaign_summary', 'charitable_template_campaign_donation_summary', 6 );
remove_action( 'charitable_campaign_summary', 'charitable_template_campaign_donor_count', 8 );
}
add_action( 'after_setup_theme', 'ed_unhook_default_template_functions', 11 );
How to remove the stats in Reach
If you are using the Reach theme, you can remove the campaign stats with the following code:
function ed_unhook_default_template_functions() {
remove_action( 'charitable_campaign_summary', 'reach_template_campaign_stats', 6 );
}
add_action( 'after_setup_theme', 'ed_unhook_default_template_functions', 21 );
How to add a code snippet
If you are new to PHP or WordPress development, we recommend adding these code snippets using the Code Snippets plugin. This allows you to add the code directly within your WordPress dashboard.
For those a little more familiar with WordPress development, you can use the snippets to create simple standalone plugins. Read the WordPress documentation about creating a plugin.
Alternatively, you could add the snippets directly to your theme or child theme’s functions.php
file.
Problems?
If you run into any problems with this, please post your code snippet into a Gist at https://gist.github.com so that I can easily help you out.