Allow Admin Access

/** * By default, Charitable disables admin access for users * who do not have one of the `edit_posts`, * `manage_charitable_settings`, or `edit_products` * capabilities. * * The code below enables access for logged in users who do * not…Continue reading

Show Admin Bar

/** * By default, Charitable hides the admin bar from users * who do not have one of the `edit_posts`, * `manage_charitable_settings`, or `edit_products` * capabilities. * * The code below shows the admin bar for logged in users who…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

Move Campaign Summary Description Below Content

/** * In this example, we shuffle the order of things on the campaign page. * We move the short description and the campaign stats block to *after* * the Extended Description. */ function ed_charitable_move_description_summary_after_content() { remove_action( ‘charitable_campaign_content_before’, ‘charitable_template_campaign_description’, 4…Continue reading