meeting-calendar icon indicating copy to clipboard operation
meeting-calendar copied to clipboard

Process the shortcode in widget texts

Open dd32 opened this issue 4 years ago • 0 comments

r16032-dotorg:

Meetings: Add shortcode processing to text widgets
Index: includes/wporg-meeting-posttype.php
===================================================================
--- includes/wporg-meeting-posttype.php	(revision 16031)
+++ includes/wporg-meeting-posttype.php	(revision 16032)
@@ -34,6 +34,10 @@
 		add_action( 'admin_bar_menu',                     array( $mpt, 'add_edit_meetings_item_to_admin_bar' ), 80 );
 		add_action( 'wp_enqueue_scripts',                 array( $mpt, 'add_edit_meetings_icon_to_admin_bar' ) );
 		add_shortcode( 'meeting_time',                    array( $mpt, 'meeting_time_shortcode' ) );
+
+		// shortcodes aren't normally processed in widgets, add this to allow meeting_type in text widgets
+		// TODO make this more specific and only add this shortcode to widget processing
+		add_filter( 'widget_text', 'do_shortcode' );
 	}

 	public function meeting_column_width() { ?>

Related to https://wordpress.slack.com/archives/C02QB8GMM/p1589055772116000

dd32 avatar May 11 '20 01:05 dd32