Use Page Template For Campaigns

/** * Instead of using the Post template for campaigns, use the Page template as a fallback. * * @param string $template * @return string $template */ function ed_campaigns_use_page_template( $template ) { global $wp_query; if ( is_main_query() && is_singular( ‘campaign’…Continue reading

Remove Stats Summary Block

/** * Remove the campaign summary block (funds raised, number of donors, etc). */ function en_remove_campaign_summary_block() { remove_action( ‘charitable_campaign_content_before’, ‘charitable_template_campaign_summary’, 6 ); // If you still want to show a Donate button, uncomment the line below. // add_action( ‘charitable_campaign_content_before’, ‘charitable_template_donate_button’,…Continue reading

Add Progress Bar Before Summary

/** * Add a progress bar to the individual campaign pages. */ function en_add_progress_bar_before_summary() { add_action( ‘charitable_campaign_content_before’, ‘charitable_template_campaign_progress_bar’, 5 ); } add_action( ‘after_setup_theme’, ‘en_add_progress_bar_before_summary’, 11 );Continue reading

Add Field To Set Custom Page As Donation Page

/** * Create a new campaign field allowing to select the page where donations are made. */ add_action( ‘init’, function() { $campaign_field = new Charitable_Campaign_Field( ‘donation_page’, array( ‘label’ => ‘Donation Page’, ‘data_type’ => ‘meta’, ‘admin_form’ => array( ‘type’ => ‘select’,…Continue reading

Remove Donor Count

/** * An example showing how to do this is provided at https://github.com/Charitable/library/blob/master/general/unhook-default-charitable-template-functions.php. * * It is a more general example that illustrates how to unhook any default Charitable template function. * * @see https://github.com/Charitable/library/blob/master/general/unhook-default-charitable-template-functions.php */Continue reading

Bulk Update Campaign End Dates

/** * Bulk-update the end date for all campaigns. */ add_action( ‘admin_init’, function() { // Retrieve all campaigns. $campaigns = Charitable_Campaigns::query( [ ‘posts_per_page’ => -1, ‘post_status’ => ‘any’, ‘fields’ => ‘ids’, ] ); foreach ( $campaigns->posts as $campaign_id ) {…Continue reading

Move Campaign Summary Below Content

/** * Move the campaign summary block (funds raised, number of donors, etc) to below the * extended description area. */ function en_move_campaign_summary_block() { remove_action( ‘charitable_campaign_content_before’, ‘charitable_template_campaign_summary’, 6 ); add_action( ‘charitable_campaign_content_after’, ‘charitable_template_campaign_summary’, 2 ); } add_action( ‘after_setup_theme’, ‘en_move_campaign_summary_block’, 11 );Continue reading

Add Post Parent Field

/** * Register a Post Parent field for campaigns. * * This will allow the campaign post parent to be edited in the * campaign management page in the WordPress dashboard. */ function ed_charitable_register_campaign_post_parent_field() { $campaigns = get_posts( array( ‘post_type’…Continue reading