New Donation Field Plus Customized Donor Name
/** * This is the full code for a tutorial written on the WP Charitable blog. * * For a step by step explanation of what each bit of code does and why, * read the post: * * @see…Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
/** * This is the full code for a tutorial written on the WP Charitable blog. * * For a step by step explanation of what each bit of code does and why, * read the post: * * @see…Continue reading
/** * 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
/** * Sometimes, it can be useful to do something special for campaigns that * have been fully funded. * * In this example, when a campaign receives a donation and is fully funded, * two things happen: * *…Continue reading
/** * 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…Continue reading
/** * 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
/** * 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
/** * 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
/** * 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. */ /** * This…Continue reading
/** * The following code will modify the way the Campaign post type * is set up to so that it uses the block editor instead of the * classic editor. */ add_filter( ‘charitable_campaign_post_type’, function( $post_type_args ) { $post_type_args[‘show_in_rest’] =…Continue reading
/** * Display the campaign creator’s name on the campaign page and in the campaign grid/list. * * @param Charitable_Campaign $campaign The campaign object. */ function ed_charitable_display_campaign_creator_name( Charitable_Campaign $campaign ) { $name = charitable_get_user( $campaign->get_campaign_creator() )->get_name(); ?> Creator:Continue reading