Advertisement
adczk

Forminator - HTML in date desc

Feb 9th, 2024 (edited)
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <?php
  2.  
  3. // HTML description for DATEPICKER field
  4. add_filter( 'forminator_field_date_markup', 'wpmudev_render_html_date_desc', 10, 2 );
  5. function wpmudev_render_html_date_desc( $html, $field ) {
  6. if ( false !== strpos( $html, '{field_description}' ) ) {
  7. $description = '<p>This is description. Click <a href="">here</a> to know more</p>';
  8. $html = str_replace( '{field_description}', $description, $html );
  9. }
  10. return $html;
  11. }
  12.  
  13.  
  14. // HTML descriptions for ADDRESS field
  15. add_filter( 'forminator_field_address_markup', 'wpmudev_render_html_address_desc', 10, 2 );
  16. function wpmudev_render_html_address_desc( $html, $field ) {
  17.  
  18. // first description
  19. if ( false !== strpos( $html, '{field_description_1}' ) ) {
  20. $description = '<p>This is 1 description. Click <a href="">here</a> to know more</p>';
  21. $html = str_replace( '{field_description_1}', $description, $html );
  22. }
  23.  
  24. // second description
  25. if ( false !== strpos( $html, '{field_description_2}' ) ) {
  26. $description = '<p>This is 2 description. Click <a href="">here</a> to know more</p>';
  27. $html = str_replace( '{field_description_2}', $description, $html );
  28. }
  29.  
  30. # you can repeat such "if" blocks more times,
  31. #just make sure to adjust number in both lines in {field_description_X} macro,
  32. #and use those macros accordingly in "Description" of Address field subfields.
  33.  
  34.  
  35. return $html;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement