Home / Admin / Add Campaign Status to Campaign Shortcode
Duplicate Snippet

Embed Snippet on Your Site

Add Campaign Status to Campaign Shortcode

This inserts the campaign status ('active', 'successful') to the [campaigns] shortcode.

https://www.wpcharitable.com/documentation/the-campaigns-shortcode/

Code Preview
php
<?php
add_action('charitable_campaign_content_loop_after', 'charitable_add_campaign_status_in_campaigns_shortcode');
function charitable_add_campaign_status_in_campaigns_shortcode( $campaign = false, $view_args = array() ) {
	if ( ! empty(  $campaign->get_status() ) ) {
		echo '<p class="campaign-status">' .  $campaign->get_status() . '</p>';
	}
}

Comments

Add a Comment