Problem: I have a CRED form that creates new posts. I have placed the form in a template and I would like to capture the title of the post where the CRED form is shown, and include that in an email notification.
Solution: You can use a generic field in the CRED form and set the value of the generic field to the title of the current post:
[cred_generic_field field='currentpagetitle' type='hidden' class='' urlparam=''] { "required":0, "validate_format":0, "default":"[wpv-post-title id='$current_page']", "persist":1 } [/cred_generic_field]
Then you can access the currentpagetitle field in an email notification using a custom placeholder %%CURRENT_PAGE_TITLE%% by adding the following code to functions.php:
add_filter('cred_body_notification_codes', 'custom_generic_field_notification'); add_filter('cred_subject_notification_codes', 'custom_generic_field_notification'); function custom_generic_field_notification( $defaultPlaceHolders ) { $newPlaceHolders = array( '%%CURRENT_PAGE_TITLE%%' => $_REQUEST['currentpagetitle'] ); return array_merge($defaultPlaceHolders, $newPlaceHolders ); }
Relevant Documentation:
https://toolset.com/documentation/user-guides/how-to-use-custom-placeholders-in-cred-notifications/
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
Este tema contiene 2 respuestas, tiene 2 mensajes.
Última actualización por hace 6 años, 6 meses.
Asistido por: Christian Cox.