Home / Archive / Remove Stats Summary Block From Specific Campaign
Duplicate Snippet

Embed Snippet on Your Site

Remove Stats Summary Block From Specific Campaign

Code Preview
php
<?php
/**
 * NOTE: This code snippet must be included in your theme's functions.php file,
 * or in a custom plugin. It will cause an error if you add it using a plugin
 * like Code Snippets.
 */
/**
 * Hide the campaign summary stats from a few specific campaign, using the campaign IDs.
 *
 * @param   Charitable_Campaign $campaign
 */
function charitable_template_campaign_summary( $campaign ) {
	// This is a comma-separated list of campaign IDs for the
	// campaigns that should not show the campaign stats.
	$no_stat_campaigns = array(
		123,
		234,
		345
	);
	if ( in_array( $campaign->ID, $no_stat_campaigns, true ) ) {
		// If you still want to show a Donate button, uncomment the line below.
		// charitable_template_donate_button( $campaign );
		return;
	}
	charitable_template( 'campaign/summary.php', array( 'campaign' => $campaign ) );
}

Comments

Add a Comment