Introduce new CiviCRM Shortcodes in WordPress
Problem
Presently, the Wordpress shortcode processing for CiviCRM parses shortcodes within pages and posts by parsing the actual output of the rendered page to see if there are shortcode available. This implementation is not only non-standard (for Wordpress), but limits the usage.
For example, adding a newsletter profile subscription in the Footer (or a Widget) requires Remote Forms, which seems kind of silly to do on the same site you are using CiviCRM. It works but a lot more extensions when it could just work out of the box.
What does it affect
- Cannot use shortcodes on custom post types
- Cannot add shortcodes to footer/widgets
- Cannot embed multiple shortcodes on the same page w/o custom code and/or hacks like Remote Forms
Proposed Solution
Maybe I'm missing something but I don't really see a reason to parse the pages/post types for shortcodes. In Wordpress, we can define the appropriate hook as follows:
add_shortcode('civicrm_blahblah', 'civicrm_blahblah_function');
This also allows for custom variables to be passed and parsed. This would then allow us to increase the shortcodes, not require Remote Forms, and enable custom post types to work.
Future
I could see this then being easily integrated with SearchKit and AFM through something like a checkbox that asks if this should be available a shortcode and a special shortcode definition is created.
cc @samuelsov